:root {
  color-scheme: light;
  --ink: #142720;
  --muted: #68746e;
  --paper: #f4f5f1;
  --card: #fff;
  --line: #e5e8e2;
  --green: #1d6b4d;
  --green-dark: #164b39;
  --lime: #d3ee68;
  --mono: "Cascadia Mono", "Yu Gothic UI", monospace;
  --sans: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  font-family: var(--sans);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  min-width: 320px;
}

button, input { font: inherit; }
button { color: inherit; }

.site-header {
  height: 68px;
  padding: 0 max(28px, calc((100vw - 1240px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e7e9e4;
  background: rgba(255,255,255,.66);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font: 500 14px var(--mono);
  letter-spacing: .07em;
}

.brand-mark {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--green);
  border-radius: 8px 8px 8px 2px;
  font: 700 14px var(--sans);
}

.election-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #42534a;
  font-size: 14px;
}

.election-label time { color: #76837b; font: 14px var(--mono); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #65a980; }
.label-divider { height: 13px; border-left: 1px solid #d9ded8; }

main { max-width: 1240px; margin: 0 auto; padding: 0 28px 72px; }

.hero {
  min-height: 254px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 35px 5.7%;
  margin: 30px 0 58px;
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 83% 20%, rgba(211,238,104,.17), transparent 28%),
    linear-gradient(112deg, #164b39, #1d6b4d 76%, #247755);
  color: white;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  width: 300px;
  height: 300px;
  position: absolute;
  right: 9%;
  top: -175px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  box-shadow: 0 0 0 32px rgba(255,255,255,.025), 0 0 0 64px rgba(255,255,255,.025);
  pointer-events: none;
}

.eyebrow, .card-kicker {
  margin: 0 0 10px;
  color: #8c9b93;
  font: 500 14px var(--mono);
  letter-spacing: .14em;
}
.hero .eyebrow { color: #c5d7ca; }
.hero h1 { margin: 0; font-size: clamp(48px, 4.2vw, 51px); letter-spacing: .015em; line-height: 1.3; }
.hero h1 span { color: var(--lime); }
.hero-description { margin: 12px 0 0; color: #dae5dc; font-size: 18px; }
.hero-total { z-index: 1; display: flex; flex-direction: column; align-items: flex-end; padding-right: 3%; }
.total-label { color: #c4d9cc; font: 14px var(--mono); letter-spacing: .12em; }
.hero-total strong { margin: -1px 0 -14px; color: white; font: 400 clamp(80px, 8vw, 96px)/1 var(--mono); letter-spacing: -.1em; }
.total-caption { color: #d3e4d8; font-size: 14px; padding-right: 5px; }

.overview-section, .map-section, .pr-section { margin-top: 0; }
.debug-section { margin-top: 28px; }
.debug-section details { padding: 17px 20px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); }
.debug-section summary { cursor: pointer; font-size: 16px; font-weight: 700; }
.debug-intro { margin: 12px 0; color: #68756e; font-size: 12px; line-height: 1.7; }
.debug-controls { display: flex; flex-wrap: wrap; gap: 12px; margin: 14px 0 20px; }
.debug-controls label { display: grid; gap: 5px; color: #68756e; font-size: 11px; }
.debug-controls select { min-width: 220px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--ink); font: inherit; }
.debug-output-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; }
.debug-output-grid > section { min-width: 0; }
.debug-output-grid h3 { margin: 0 0 9px; font-size: 14px; }
.debug-output-grid h4 { margin: 16px 0 7px; font-size: 12px; }
.debug-meta { margin: 0 0 10px; color: #68756e; font-size: 11px; line-height: 1.7; }
.debug-contributions { min-width: 260px; text-align: left !important; line-height: 1.6; }
.debug-table-wrap { max-width: 100%; overflow: auto; border: 1px solid #e6eae4; border-radius: 8px; }
.debug-table { width: 100%; border-collapse: collapse; font-size: 11px; white-space: nowrap; }
.debug-table th, .debug-table td { padding: 7px 9px; border-bottom: 1px solid #edf0eb; text-align: right; }
.debug-table th { position: sticky; top: 0; background: #f5f7f3; color: #68756e; font-weight: 600; }
.debug-table th:first-child, .debug-table td:first-child { position: sticky; left: 0; text-align: left; background: #fbfcfa; }
.debug-table tbody tr:last-child td { border-bottom: 0; }
.debug-source-map { margin: 8px 0 12px; color: #68756e; font-size: 10px; line-height: 1.7; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-heading .eyebrow { margin-bottom: 7px; }
.section-heading h2 { margin: 0; font-size: 25px; letter-spacing: -.03em; }
.section-note { margin: 0 0 3px; color: #617068; font-size: 12px; }
.section-note span { margin: 0 5px; color: #b3bdb6; }
.unit {white-space: nowrap;}

.overview-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.overview-section .section-heading h2 { font-size: 27px; }
.overview-section .section-note { font-size: 18px; }
.party-results, .chart-card, .district-map, .district-detail, .pr-map {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.party-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(277px,1fr)); gap: 5px 20px; padding: 9px 23px; }
.party-row { min-width: 0; display: grid; grid-template-columns: 10px minmax(55px,1fr) 50px 50px 80px; align-items: center; gap: 8px; border-bottom: 1px solid #eff1ed; min-height: 53px; }
.party-row:last-child, .party-row:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
.party-swatch { width: 8px; height: 24px; border-radius: 5px; }
.party-name { overflow: hidden; text-overflow: ellipsis; font-size: 20px; font-weight: 600; }
.party-numbers { text-align: right; font: 20px var(--mono); color: #505a55; }
.party-numbers.total { color: var(--ink); font-weight: 500; font-size: 40px; text-align: center; }
.party-head { display: grid; grid-template-columns: 10px minmax(55px,1fr) 50px 50px 55px 17px; gap: 8px; padding: 7px 0 2px; color: #9ba59e; font: 14px var(--mono); }
.party-head span:not(:first-child):not(:nth-child(2)) { text-align: right; }
.party-head span:nth-child(3) {white-space: nowrap;}

.pr-national-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 0 20px;
  padding: 12px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 13px;
}
.pr-national-head,
.pr-national-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}
.pr-national-head {
  grid-column: 1 / -1;
  padding: 7px 0 2px;
  color: #9ba59e;
  font: 14px var(--mono);
}
.pr-national-head span:last-child { text-align: right; }
.pr-national-row {
  min-width: 0;
  min-height: 64px;
  border-bottom: 1px solid #eff1ed;
}
.pr-national-party {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  overflow-wrap: anywhere;
  font-size: 20px;
  font-weight: 600;
}
.pr-national-party .party-swatch { flex: 0 0 8px; }
.pr-national-votes {
  color: var(--ink);
  font: 20px var(--mono);
  text-align: right;
}

.chart-card { padding: 19px 22px 15px; }
.chart-heading { display: flex; justify-content: space-between; align-items: flex-start; }
.chart-heading .card-kicker { display: block; margin-bottom: 5px; font-size: 14px; }
.chart-heading h3 { margin: 0; font-size: 24px; }
.chart-unit { color: #89948e; font: 14px var(--mono); }
.seat-chart { min-height: 150px; display: flex; justify-content: center; align-items: flex-end; overflow: hidden; }
.seat-chart svg { display: block; width: min(100%, 630px); height: auto; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 7px 13px; margin-top: 5px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; color: #657168; font-size: 20px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.chart-center-number { fill: var(--ink); font: 500 42px var(--mono); }
.chart-center-caption { fill: #89948e; font: 14px var(--mono); letter-spacing: .12em; }

.map-section, .pr-section { margin-top: 62px; }
.map-section-heading { margin-bottom: 9px; }
.map-intro { margin: 0 0 18px; color: #79847d; font-size: 12px; }
.search-box { height: 38px; width: min(290px, 42vw); display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid #dce1da; background: #fff; border-radius: 8px; color: #818d85; }
.search-box > span:not(.sr-only) { font-size: 21px; line-height: 1; transform: rotate(-20deg); }
.search-box input { width: 100%; border: 0; outline: none; color: var(--ink); background: transparent; font-size: 11px; }
.search-box input::placeholder { color: #9ba49e; }

.district-legend { display: flex; flex-wrap: wrap; gap: 7px 13px; margin: -4px 0 13px; }
.district-legend-item { display: inline-flex; align-items: center; gap: 5px; color: #657168; font-size: 16px; }
/* 凡例の小さな色見本。党名テキストは .district-legend-item 本体が表示する。 */
.district-legend-item i { width: 9px; height: 9px; border-radius: 2px; }
.district-change-filter { display: flex; width: fit-content; align-items: center; gap: 8px; margin: 0 0 12px; color: #536158; font-size: 14px; cursor: pointer; }
.district-change-filter input { width: 18px; height: 18px; margin: 0; accent-color: var(--green); }
/* 都道府県カードを載せる地図面。縦画面ではカードを順に折り返す。 */
.district-map { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 13px; }
/* 県カードの外枠・背景。 */
.prefecture-tile { width: max-content; max-width: 100%; padding: 7px; border: 2px solid #d6ded7; border-radius: 8px; background: #fcfdfb; }
/* カード上部の都道府県名と、括弧付き選挙区数。 */
.prefecture-name { display: flex; align-items: center; gap: 5px; margin: 0 0 7px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.prefecture-name small { color: #9aa49d; font: 9px var(--mono); font-weight: 400; }
/* 選挙区マスの並び。列数はJavaScriptが都道府県ごとに指定する。 */
.district-cells { display: grid; grid-template-columns: repeat(var(--district-columns), var(--district-cell-size, 20px)); gap: var(--district-cell-gap, 2px); }
/* 当選党派色を背景にした、1選挙区分の四角いマス。 */
.district-cell { width: var(--district-cell-size, 20px); height: var(--district-cell-size, 20px); position: relative; padding: 0; border: 0; border-radius: 3px; cursor: pointer; transition: transform .14s, box-shadow .14s; }
/* 四角の左上に重ねる選挙区番号。 */
.district-cell::before { content: attr(data-number); position: absolute; top: calc(var(--district-cell-size, 20px) * .05); left: calc(var(--district-cell-size, 20px) * .1); color: #ffffffd9; font: max(4px, calc(var(--district-cell-size, 20px) * .3))/1 var(--mono); }
/* 四角の中央に重ねる当選党派の一文字略称。 */
.district-cell::after { content: attr(data-marker); position: absolute; inset: 0; display: grid; place-items: center; padding-top: calc(var(--district-cell-size, 20px) * .1); color: #fff; font-size: max(6px, calc(var(--district-cell-size, 20px) * .48)); font-weight: 800; line-height: 1; }
.district-cell:hover, .district-cell:focus-visible { transform: scale(1.14); box-shadow: 0 2px 7px #183b2940; outline: 2px solid #fff; outline-offset: 1px; }
.district-cell[hidden], .prefecture-tile[hidden] { display: none; }
.no-matches { padding: 36px 18px; color: #758078; text-align: center; font-size: 13px; grid-column: 1/-1; }

/* 横画面では都道府県カードを地理的な列・行位置へ配置するグリッド。 */
.district-map.is-landscape {
  display: grid;
  grid-template-columns: repeat(var(--landscape-grid-columns), var(--map-unit-size));
  grid-template-rows: repeat(var(--landscape-grid-rows), var(--map-unit-size));
  align-content: start;
  gap: 0;
  padding: var(--district-map-padding, 15px);
}
.district-map.is-landscape .prefecture-name {
  height: var(--map-unit-size);
  margin: 0 0 2px;
  overflow: visible;
  line-height: var(--map-unit-size);
}
/* 県カードと中のマスを、定義済みの方眼座標・寸法に合わせる。 */
.district-map.is-landscape .prefecture-tile {
  position: relative;
  grid-column: var(--map-column) / span var(--map-column-span);
  grid-row: var(--map-row) / span var(--map-row-span);
  width: auto;
  max-width: none;
  min-width: 0;
  padding: 0;
  border-width: 0;
  background: transparent;
  align-self: start;
}
.district-map.is-landscape .prefecture-tile::before {
  content: "";
  position: absolute;
  inset: calc(var(--map-unit-size) * -.5);
  border: 2px solid #d6ded7;
  border-radius: 8px;
  pointer-events: none;
}
.district-map.is-landscape .prefecture-name,
.district-map.is-landscape .district-cells {
  position: relative;
  z-index: 1;
}

.district-dialog {
  width: min(760px, calc(100vw - 32px));
  max-width: none;
  max-height: min(88vh, 900px);
  padding: 42px 20px 20px;
  overflow: auto;
  border: 1px solid #dce2da;
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 80px #10291e40;
}
.district-dialog::backdrop { background: #10251dcc; backdrop-filter: blur(3px); }
.district-dialog-close {
  width: 44px;
  height: 44px;
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  border: 1px solid #e1e7df;
  border-radius: 50%;
  background: #fff;
  color: #546258;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}
.district-dialog-close:hover { background: #edf3ec; }
.district-detail { margin-top: 12px; padding: 17px 20px; min-height: 94px; }
.district-dialog .district-detail { min-height: 0; padding: 0; margin: 0; border: 0; border-radius: 0; }
.district-dialog .pr-expanded { padding: 0; border: 0; background: transparent; }
.district-dialog .pr-expanded h3 { margin: 0 0 12px; font-size: 24px; }
.detail-empty { display: flex; align-items: center; gap: 12px; color: #6f7d74; }
.detail-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 50%; background: #f0f4ed; color: var(--green); font-size: 17px; }
.detail-empty strong { font-size: 14px; }
.detail-empty p { margin: 4px 0 0; color: #909b93; font-size: 14px; }
.detail-heading { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.detail-heading h3 { margin: 0; font-size: 24px; }
.detail-heading p { margin: 4px 0 0; color: #849087; font-size: 14px; }
.detail-winner { display: flex; align-items: center; gap: 9px; margin: 15px 0 12px; }
.previous-winner-badge { display: inline-block; margin-left: 5px; padding: 2px 6px; border-radius: 999px; background: #edf2e9; color: #536b4b; font-size: 11px; font-weight: 700; white-space: nowrap; }
.previous-winner-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: -3px 0 12px 13px; color: #59675e; font-size: 14px; }
.previous-winner-note span { color: #87928b; }
.previous-winner-note .previous-winner-badge { margin-left: 3px; }
.detail-party-bar { width: 4px; align-self: stretch; min-height: 37px; border-radius: 4px; }
.winner-label { color: #87928b; font: 14px var(--mono); }
.winner-name { display: block; margin-top: 2px; font-size: 20px; font-weight: 700; }
.winner-party { margin-left: auto; color: #758178; font-size: 14px; }
.candidate-list { display: grid; gap: 2px; }
.candidate-row { display: block; grid-template-columns: minmax(0, 1fr); gap: 4px 10px; align-items: center; padding: 12px 0; border-top: 1px solid #eef0ec; font-size: 14px; }
.candidate-row.is-winner { font-weight: 700; }
.candidate-identity { min-width: 0; display: flex; justify-content: space-between; grid-template-columns: minmax(180px, 1fr) minmax(160px, auto); gap: 12px; align-items: center; }
.candidate-name { min-width: 0; font-size: inherit; font-weight: 700; }
.candidate-name small { display: inline-block; padding: 2px 5px; margin-left: 4px; border-radius: 3px; background: #edf3ec; color: #46694f; font-size: 8px; font-weight: 600; }
.candidate-party { min-width: 0; display: flex; align-items: center; gap: 6px; color: #758178; }
.candidate-party-mark { width: 14px; height: 14px; flex: 0 0 auto; border-radius: 50%; }
.candidate-results { min-width: 0; display: grid; gap: 0px; }
.candidate-metrics { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 18px; }
.candidate-votes { text-align: right; color: #46564c; font: 10px var(--mono); white-space: nowrap; }
.candidate-rate { color: #718077; text-align: right; font: 9px var(--mono); white-space: nowrap; }
.candidate-track { height: 30px; background: #edf0eb; border-radius: 8px; overflow: hidden; }
.candidate-fill { height: 100%; border-radius: inherit; }
.detail-footnote { margin: 0; color: #919b94; font-size: 14px; }

.pr-seat-total { color: var(--green); font: 400 24px var(--mono); }
.pr-seat-total small { color: #87928b; font: 14px var(--sans); }
.pr-map { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); grid-auto-rows: auto; gap: 8px; overflow: visible; }
.pr-block {padding: 14px 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-align: left; font: inherit; cursor: pointer; transition: background .14s, transform .14s; }
.pr-block:hover, .pr-block[aria-expanded="true"] { background: #f8faf6; }
.pr-block:hover { transform: translateY(-2px); }
.map-region + .map-region { margin-top: 13px; padding-top: 6px; border-top: 1px solid #eff1ed; }
.pr-block-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 12px; }
.pr-block-heading-meta { display: inline-flex; align-items: center; gap: 7px; }
.pr-block-name { font-size: 20px; font-weight: 700; }
.pr-block-total { color: #849087; font: 20px var(--mono); }
.pr-block-warning { padding: 3px 5px; border-radius: 4px; background: #fff3de; color: #96651c; font-size: 8px; font-style: normal; white-space: nowrap; }
.pr-bars { display: grid; gap: 9px; }
.pr-party-row { min-width: 0; display: grid; gap: 4px; font-size: 20px; }
.pr-party-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pr-party-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #69766e; }
.pr-party-count { text-align: right; color: #3d4d43; font: 24px var(--mono); }
.pr-seat-squares { display: flex; flex-wrap: wrap; gap: 3px; }
.pr-seat-square { width: 14px; height: 14px; flex: 0 0 9px; border-radius: 2px; box-shadow: inset 0 0 0 1px #00000012; }
.pr-more { margin-top: 10px; color: #829087; font-size: 14px; }
.pr-expanded { grid-column: 1/-1; padding: 15px 18px; border-top: 1px solid #e7ece4; background: #f8faf6; }
.pr-expanded h3 { margin: 0 0 12px; font-size: 24px; }
.pr-cutoff-note { margin: -4px 0 3px; color: #68756e; font-size: 14px; }
.pr-cutoff-note strong { color: var(--ink); font: 600 16px var(--mono); }
.pr-comparison-legend { display: flex; flex-wrap: wrap; gap: 3px 7px; margin-bottom: 2px; color: #718077; font-size: 14px; }
.pr-comparison-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.pr-legend-dashed, .pr-legend-filled { width: 20px; height: 9px; display: inline-block; border-radius: 3px; }
.pr-legend-dashed { border: 1.5px dashed var(--green); }
.pr-legend-filled { background: var(--green); }
.pr-allocation-note { padding: 8px 10px; margin: 0 0 3px; border: 1px solid #f0dcad; border-radius: 6px; background: #fffaf0; color: #825c1c; font-size: 14px; line-height: 1.6; }
.pr-allocation-note.is-matched { border-color: #dfe9dc; background: #f4f8f1; color: #58715a; }
.pr-axis-title { margin-bottom: 2px; color: #88948c; font-size: 14px; }
.pr-analysis-row { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 4fr); gap: 18px; align-items: center; padding: 16px 0; border-top: 1px solid #e9ede7; }
.pr-analysis-identity { min-width: 0; display: flex; align-items: flex-start; gap: 9px; }
.pr-analysis-dot { width: 14px; height: 14px; border-radius: 50%; }
.pr-analysis-party { min-width: 0; color: #405046; font-size: 20px; line-height: 1.4; overflow-wrap: anywhere; }
.pr-analysis-content { min-width: 0; display: grid; gap: 10px; }
.pr-analysis-metrics { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 16px; }
.pr-analysis-votes { color: #728078; font: 14px var(--mono); }
.pr-analysis-multiple { color: var(--ink); font: 600 14px var(--mono); }
.pr-analysis-redistributed-multiple { color: #627266; font: 14px var(--mono); }
.pr-analysis-seats { color: #758178; font-size: 14px; }
.pr-analysis-metrics strong { color: var(--ink); font-weight: 700; }
.pr-analysis-seats span { padding: 0 4px; color: #b1bbb3; }
.pr-comparison-track { height: 42px; position: relative; overflow: hidden; border: 1px solid #e3e8e1; border-radius: 8px; background: repeating-linear-gradient(90deg, #e8ece6 0 1px, transparent 1px var(--step-width)); }
.pr-theoretical-bar { height: 34px; position: absolute; z-index: 2; top: 3px; left: 0; border: 2px dashed; border-radius: 7px; pointer-events: none; }
.pr-theoretical-bar[style*="width:0%"] { display: none; }
.pr-actual-bar { height: 22px; position: absolute; z-index: 1; top: 9px; left: 0; border-radius: 7px; }
.pr-axis-container { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 4fr); gap: 18px; align-items: center; padding: 16px 0; border-top: 1px solid #e9ede7; }
.pr-axis { height: 22px; position: relative; border-top: 1px solid #dfe5dd; }
.pr-axis span { position: absolute; top: 3px; color: #89958d; font: 14px var(--mono); transform: translateX(-50%); }
.pr-axis span:first-child { transform: none; }

.site-footer { max-width: 1240px; padding: 18px 28px 22px; margin: 0 auto; display: flex; justify-content: space-between; gap: 15px; border-top: 1px solid #e5e8e2; color: #919b94; font-size: 14px; }
.site-footer > span:first-child { color: #647269; font: 14px var(--mono); letter-spacing: .1em; }
.site-footer a { color: inherit; text-decoration: underline; text-decoration-color: #c9d0c9; text-underline-offset: 2px; }
.footer-divider { padding: 0 4px; color: #bbc2bc; }
.sr-only { width: 1px; height: 1px; position: absolute; clip: rect(0,0,0,0); overflow: hidden; white-space: nowrap; }
.data-error { max-width: 1240px; margin: 20px auto; padding: 16px 28px; color: #8f312b; background: #fff1ee; border: 1px solid #f0c7c2; border-radius: 8px; font-size: 13px; }

.pr-block {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  grid-column: auto !important;
  grid-row: auto !important;
  padding: 16px;
}
.pr-block-warning { font-size: 14px !important; }
.pr-bars { gap: 12px; }
.pr-party-row { gap: 6px; }
.pr-seat-square { width: 12px; height: 12px; flex-basis: 12px; }


/* 詳細の候補者名・党派名は同じ視認性にし、左右で情報と長い棒を整理する。 */
.district-dialog-close {
  width: 48px;
  height: 48px;
  font-size: 34px;
}
.district-dialog .detail-heading h3,
.district-dialog .pr-expanded h3 { padding-right: 48px; }
.detail-heading { flex-wrap: wrap; padding-right: 48px; }
.candidate-row {
  grid-template-columns: minmax(150px, 1fr) minmax(0, 4fr);
  gap: 18px;
  align-items: center;
  padding: 10px 0;
}
.candidate-name {
  display: block;
  margin-bottom: 6px;
  font-size: 20px !important;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.candidate-party {
  display: flex;
  align-items: flex-start;
  font-size: 16px !important;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.candidate-votes,
.candidate-rate { font-size: 20px !important; }
.candidate-track { height: 30px; border-radius: 8px; }
.candidate-fill { border-radius: inherit; }

/* 比例代表は左約2割に党名、右約8割に数値情報と主役の棒グラフを置く。 */
.pr-analysis-row {
  grid-template-columns: minmax(150px, 1fr) minmax(0, 4fr);
  gap: 18px;
  padding: 5px 0;
}
.pr-analysis-identity { align-items: flex-start; }
.pr-analysis-content { gap: 5px; }
.pr-analysis-metrics { gap: 6px 18px; }
.pr-analysis-votes,
.pr-analysis-multiple,
.pr-analysis-redistributed-multiple,
.pr-analysis-seats { font-size: 14px !important; }
.pr-analysis-metrics strong { font-size: 16px !important; }
.pr-comparison-track { height: 42px; }
.pr-actual-bar { height: 30px; top: 5px; border-radius: 8px; }
.pr-theoretical-bar { height: 36px; top: 2px; border-radius: 8px; }


.forecast-data-notice {
  margin: -39px 0 42px;
  padding: 14px 18px;
  border: 1px solid #e7d9a9;
  border-radius: 9px;
  background: #fff9e8;
  color: #342b12;
  font-size: 16px;
  line-height: 1.7;
}
.pr-national-votes {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: inherit !important;
}
.pr-national-votes strong,
.candidate-rate,
.pr-analysis-share {
  color: var(--ink);
  font: 700 26px/1.25 var(--mono) !important;
  white-space: nowrap;
}
.pr-national-votes small,
.candidate-votes,
.pr-analysis-votes {
  color: #78847c;
  font: 14px/1.4 var(--mono) !important;
  white-space: nowrap;
}
.pr-analysis-share { margin-right: 2px; }
@media (max-width: 900px) {
  .pr-national-results { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 8px 14px; }
}

@media (max-width: 600px) {
  .debug-section details { padding: 14px; }
  .debug-output-grid { grid-template-columns: minmax(0, 1fr); }
  .debug-controls select { min-width: min(220px, 80vw); }
  .site-header { height: 57px; padding: 0 17px; }
  .brand { font-size: 10px; }
  .election-label { gap: 6px; font-size: 10px; }
  .election-label time { font-size: 10px; }
  main { padding: 0 15px 48px; }
  .eyebrow,
  .chart-heading .card-kicker { font-size: 10px; }
  .card-kicker { font-size: 10px; }
  .hero { min-height: 206px; margin: 17px 0 42px; padding: 26px 23px; border-radius: 13px; }
  .hero h1 { font-size: 32px; }
  .hero-description { max-width: 210px; font-size: 11px; line-height: 1.8; }
  .hero-total { padding-right: 0; }
  .hero-total strong { font-size: 63px; margin-bottom: -8px; }
  .total-label { font-size: 9px; }
  .section-heading { align-items: flex-end; }
  .overview-layout { display: block;}
  .overview-section .section-heading h2 { font-size: 28px; }
  .section-heading h2 { font-size: 28px; }
  .overview-section .section-note { max-width: 120px; text-align: right; font-size: 12px; line-height: 1.7; }
    .party-results {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 8px 14px;
  }
.party-results { padding: 5px 13px; gap: 3px 11px; }
  .party-row { grid-template-columns: 8px minmax(0,1fr) 50px 50px 60px; gap: 5px; }
  .party-head { grid-template-columns: 8px minmax(0,1fr) 50px 50px 42px 13px; gap: 5px; }
  .party-row { min-height: 47px; }
  .party-name { font-size: 18px; }
  .party-numbers { font-size: 20px; }
  .party-numbers.total { font-size: 30px; }
  .party-head { font-size: 12px; }
  .chart-card { padding: 16px; }
  .seat-chart { min-height: 125px; }
  .chart-legend { gap: 7px 10px; }
  .legend-item { font-size: 14px; }
  .map-section, .pr-section { margin-top: 46px; }
  .map-section-heading { align-items: flex-end; }
  .search-box { width: min(195px, 54vw); height: 34px; padding: 0 8px; }
  .search-box input { font-size: 9px; }
  .map-intro { font-size: 10px; line-height: 1.8; }
  .district-map { gap: 6px; padding: 9px; }
  .district-legend { gap: 7px 10px; }
  .district-legend-item { font-size: 14px; }
  .prefecture-tile { padding: 7px; }
  .district-dialog { width: calc(100vw - 20px); max-height: 90vh; padding: 42px 14px 14px; border-radius: 12px; }
  .district-detail { padding: 14px; }
  .candidate-row { grid-template-columns: minmax(0,1fr) auto; gap: 4px 8px; font-size: 9px; }
  .candidate-name { grid-column: 1; grid-row: 1; }
  .candidate-votes { grid-column: 2; grid-row: 1; }
  .candidate-party { grid-column: 1; grid-row: 2; }
  .candidate-rate { grid-column: 2; grid-row: 2; }
  .candidate-track { grid-row: 3; height: 9px; }
  .candidate-votes { font-size: 9px; }
  .pr-map { grid-template-columns: repeat(2,minmax(0,1fr)); grid-auto-rows: auto; }
  .pr-block { grid-column: auto !important; grid-row: auto !important; padding: 14px 12px; }
  .pr-block-name { font-size: 18px; }
  .pr-block-total { font-size: 18px; }
  .pr-party-row { font-size: 16px; }
  .pr-party-count { font-size: 20px; }
  .pr-seat-square { width: 14px; height: 14px; flex-basis: 14px; }
  .pr-expanded { padding: 13px 10px; }
  .district-dialog .pr-expanded h3 { font-size: 20px; }
  .pr-analysis-row { grid-template-columns: 1fr; gap: 7px; }
  .pr-analysis-label { grid-template-columns: 8px minmax(55px,1fr) minmax(65px,auto) minmax(35px,auto) minmax(35px,auto); gap: 4px 5px; }
  .pr-analysis-votes, .pr-analysis-multiple, .pr-analysis-redistributed-multiple { font-size: 8px; }
  .pr-analysis-seats { font-size: 8px; }
  .pr-analysis-party { font-size: 18px }
  .pr-cutoff-note,
  .pr-comparison-legend { font-size: 10px; }
  .pr-cutoff-note strong { font-size: 12px; }
  .pr-allocation-note { padding: 4px 5px;font-size: 10px;}
  .pr-axis-title { font-size: 10px; }
  .site-footer { padding: 15px; flex-direction: column; }
  .forecast-data-notice { margin: -30px 0 34px; padding: 12px 14px; font-size: 14px; }
  .pr-national-votes strong,
  .candidate-rate,
  .pr-analysis-share { font-size: 22px !important; }
  .pr-national-votes small,
  .candidate-votes,
  .pr-analysis-votes { font-size: 13px !important; }
  .candidate-row,
  .pr-analysis-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .pr-axis-container { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .candidate-identity { display: flex; grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .candidate-name { margin-bottom: 0; }
  .candidate-metrics { justify-content: flex-end; }
  .candidate-track { height: 30px; }
  .pr-analysis-identity { align-items: center; }
  .pr-analysis-metrics { gap: 0px 12px; }
  .detail-footnote {font-size: 12px;}
  .site-footer > span:first-child { font-size: 12px;}
}
@media (max-width: 700px) {
  .pr-national-results { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 8px 14px; }
  .pr-national-head { font-size: 14px !important; }
  .pr-national-row { min-height: 58px; }
  .pr-national-party,
  .pr-national-votes { font-size: 20px !important; }
  .district-map { gap: 9px; padding: 13px; }
  .prefecture-tile { padding: 10px; }
  .prefecture-name { font-size: 16px; }
  .prefecture-name small { font-size: 13px; }
  .chart-card { padding: 16px 4px 12px; }
  .chart-heading { padding: 0 12px; }
  .seat-chart { min-height: 0; width: 100%; overflow: visible; }
  .seat-chart svg { width: 100%; max-width: none; }
  .chart-legend { padding: 0 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
