.book-page .section-header-block {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.book-page .section-header-block h1 {
  max-width: 980px;
  font-size: clamp(28px, 3.1vw, 40px);
  line-height: 1.25;
}

.book-page .section-header-block .lead {
  margin-top: 18px;
  font-size: 16px;
  line-height: 1.72;
}

.book-page .panel > h2,
.book-page .chart-panel-header h2 {
  font-size: 17px;
  line-height: 1.42;
}

.book-page .chart-panel-header h3 {
  font-size: 16px;
  line-height: 1.42;
}

.book-chart {
  height: 420px;
}

.pyramid-panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  height: auto;
}

.pyramid-panel {
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.pyramid-panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.pyramid-panel-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--ink);
}

.pyramid-panel-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pyramid-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 360px;
}

.pyramid-grid-line {
  stroke: rgba(15, 23, 42, .08);
  stroke-width: 1;
}

.pyramid-center-line {
  stroke: rgba(15, 23, 42, .34);
  stroke-width: 1.2;
}

.pyramid-bar {
  shape-rendering: geometricPrecision;
}

.pyramid-bar.male {
  fill: #2563eb;
}

.pyramid-bar.female {
  fill: #e11d48;
}

.pyramid-side-label {
  font-size: 15px;
  font-weight: 800;
}

.male-label {
  fill: #1d4ed8;
}

.female-label {
  fill: #be123c;
}

.pyramid-age-label {
  fill: #334155;
  font-size: 10px;
  font-weight: 700;
}

.pyramid-tick,
.pyramid-axis-note {
  fill: #64748b;
  font-size: 11px;
}

.chart-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.chart-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.chart-panel-header h2,
.chart-panel-header h3 {
  margin: 0;
  min-width: 0;
}

.chart-panel-header .csv-button {
  flex: 0 0 auto;
  margin-top: 2px;
}

.source-actions {
  margin-top: 10px;
}

.csv-button {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid var(--teal);
  color: var(--teal);
  background: #ffffff;
  text-decoration: none;
  font-weight: 700;
}

.csv-button:hover {
  background: #eef4f1;
}

.source-note {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.reading-note {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(15, 23, 42, .1);
  max-width: 920px;
}

.reading-note h3 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 18px;
}

.reading-note p {
  margin: 0 0 10px;
  color: #334155;
  font-size: 16px;
  line-height: 1.82;
}

.reading-note p:last-child {
  margin-bottom: 0;
}

.book-narrative {
  max-width: 920px;
  padding: 8px 0 2px;
}

.book-narrative .kicker {
  margin: 0 0 12px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .04em;
}

.book-narrative p:not(.kicker) {
  margin: 0 0 16px;
  color: #334155;
  font-size: 17px;
  line-height: 1.9;
}

.book-narrative p:last-child {
  margin-bottom: 0;
}

.analysis-panel p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.78;
}

.analysis-panel p:last-child {
  margin-bottom: 0;
}

.evidence-panel {
  border-color: rgba(15, 118, 110, .22);
  background: #fbfdfc;
}

.supplemental-panel {
  background: #fbfcff;
  border-color: rgba(37, 99, 235, .2);
}

.supplement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.supplement-chart {
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.supplement-chart h3 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
}

.small-book-chart {
  height: 300px;
}

.cohort-panel-chart {
  height: auto;
  display: grid;
  gap: 16px;
}

.cohort-region-panel {
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.cohort-region-panel header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(15, 23, 42, .08);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.cohort-region-panel h3 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
}

.cohort-region-panel header span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: right;
}

.cohort-region-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.cohort-mini-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.panel-chart-title {
  font-size: 15px;
  font-weight: 800;
  fill: var(--ink);
}

.panel-axis,
.panel-axis-tick-line {
  stroke: rgba(15, 23, 42, .35);
  stroke-width: 1;
}

.panel-axis-grid {
  stroke: rgba(15, 23, 42, .09);
  stroke-width: 1;
}

.panel-axis-tick,
.panel-axis-label {
  fill: #64748b;
  font-size: 11px;
}

.panel-axis-label {
  font-weight: 700;
}

.panel-line {
  fill: none;
  stroke: var(--panel-color, #2563eb);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.panel-point {
  fill: #fff;
  stroke: var(--panel-color, #2563eb);
  stroke-width: 2;
}

.elderly-labor-panel-chart {
  height: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.elderly-labor-panel {
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.elderly-labor-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.elderly-labor-line,
.elderly-labor-legend-line {
  fill: none;
  stroke: var(--line-color, #2563eb);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.elderly-labor-legend-line {
  stroke-width: 3;
}

.elderly-labor-point {
  fill: #fff;
  stroke: var(--line-color, #2563eb);
  stroke-width: 2;
}

.regional-slope-panel-chart {
  height: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.regional-slope-panel {
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.regional-slope-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.regional-slope-guide {
  stroke: rgba(15, 23, 42, .06);
  stroke-width: 1;
}

.regional-slope-zero {
  stroke: rgba(15, 23, 42, .35);
  stroke-width: 1.2;
  stroke-dasharray: 4 4;
}

.regional-slope-dot {
  fill: var(--dot-color, #2563eb);
  stroke: #fff;
  stroke-width: 1.4;
}

.regional-slope-region,
.regional-slope-value {
  fill: #334155;
  font-size: 10.5px;
  font-weight: 700;
}

.regional-slope-value {
  fill: #64748b;
  font-weight: 800;
}

.foreigner-definition-chart {
  height: auto;
}

.foreigner-definition-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.foreigner-definition-card {
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.definition-source {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
}

.foreigner-definition-card h3 {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.35;
}

.foreigner-definition-card dl {
  margin: 0;
  display: grid;
  gap: 10px;
}

.foreigner-definition-card dt {
  margin-bottom: 2px;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}

.foreigner-definition-card dd {
  margin: 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.62;
}

.foreign-share-panel-chart {
  height: auto;
}

.foreign-panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.foreign-share-panel {
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.foreign-share-panel svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.evidence-item {
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.design-note-panel {
  background: #fafafa;
}

.program-table-panel {
  margin-top: 20px;
}

.table-actions {
  margin: 12px 0 14px;
}

.data-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: 8px;
  background: #fff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 840px;
  font-size: 14px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, .08);
  text-align: left;
  vertical-align: top;
}

.data-table thead th {
  background: #f8fafc;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.data-table tbody tr:nth-child(even) {
  background: #fbfdff;
}

.data-table tfoot th {
  background: #f8fafc;
  color: var(--ink);
}

.data-table .num,
.data-table th.num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.evidence-item h3,
.evidence-item h4 {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
}

.appendix-chapter {
  margin-top: 20px;
}

.appendix-section + .appendix-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(15, 23, 42, .08);
}

.appendix-section h3 {
  margin: 0 0 14px;
  font-size: 18px;
  color: var(--ink);
}

.evidence-item dl {
  margin: 0;
  display: grid;
  gap: 10px;
}

.evidence-item div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
}

.evidence-item dt {
  font-weight: 800;
  color: var(--teal);
  font-size: 13px;
}

.evidence-item dd {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.evidence-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.evidence-link {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 12px;
}

.toc-section {
  padding-left: 18px !important;
  font-size: 12px !important;
}

.toc a.active,
.toc .chapter.active {
  background: var(--paper);
  color: var(--teal);
  font-weight: 800;
}

.markdown-manuscript {
  display: grid;
  gap: 18px;
}

.markdown-manuscript > p,
.markdown-manuscript > ul {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.9;
}

.markdown-manuscript > h2 {
  margin: 14px 0 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.45;
}

.markdown-manuscript > h3 {
  margin: 10px 0 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
}

.markdown-manuscript ul {
  padding-left: 22px;
}

.markdown-manuscript li + li {
  margin-top: 6px;
}

.markdown-manuscript code {
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(15, 23, 42, .06);
  font-size: .92em;
}

.math-block {
  margin: 2px 0;
  overflow-x: auto;
  color: var(--ink);
}

.policy-typology-chart {
  height: auto;
  min-height: 0;
}

.policy-typology-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.policy-typology-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(15, 23, 42, .11);
  border-radius: 8px;
  background: #fff;
}

.policy-typology-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #eef4f1;
  color: var(--teal);
  font-weight: 900;
}

.policy-typology-card h3 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.38;
}

.policy-typology-card p {
  margin: 0 0 10px;
  color: #334155;
  font-size: 14px;
  line-height: 1.65;
}

.policy-typology-card dl,
.policy-typology-card dt,
.policy-typology-card dd {
  margin: 0;
}

.policy-typology-card dl {
  display: grid;
  gap: 8px;
}

.policy-typology-card dt {
  margin-bottom: 2px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.policy-typology-card dd {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

@media (max-width: 820px) {
  .policy-typology-grid {
    grid-template-columns: 1fr;
  }
}

.manuscript-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.manuscript-edit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid rgba(15, 23, 42, .14);
  border-radius: 8px;
  background: #fff;
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.manuscript-edit-button:hover {
  background: var(--paper);
}

.readonly-note {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.feedback-button {
  color: #ffffff;
  border-color: var(--teal);
  background: var(--teal);
}

.feedback-button:hover {
  color: #ffffff;
  background: #16635f;
}

.markdown-chart-panel {
  margin: 8px 0;
}

.sigungu-slope-map-chart {
  min-height: 620px;
  height: auto;
  overflow-x: auto;
}

.sigungu-slope-map-wrap {
  width: 100%;
}

.sigungu-slope-map-svg {
  display: block;
  width: 100%;
  min-width: 540px;
  height: auto;
  background: #ffffff;
}

.sigungu-map-path {
  stroke: #ffffff;
  stroke-width: .7;
  vector-effect: non-scaling-stroke;
}

.sigungu-map-path:hover {
  stroke: #111827;
  stroke-width: 1.4;
}

.sigungu-map-title {
  fill: #0f172a;
  font-size: 16px;
  font-weight: 760;
}

.sigungu-map-subtitle,
.sigungu-map-note,
.sigungu-map-legend text,
.sigungu-map-top {
  fill: #475569;
  font-size: 13px;
}

.sido-migration-panel-chart {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  height: auto;
  min-height: 720px;
}

.sido-migration-panel {
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.sido-migration-svg {
  display: block;
  width: 100%;
  height: auto;
}

.migration-panel-line {
  stroke: var(--panel-color, #2563eb);
}

.migration-zero-line {
  stroke: rgba(15, 23, 42, .38);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.migration-age-contribution-chart {
  height: 680px;
  min-height: 680px;
}

.household-region-gap-chart {
  height: 620px;
  min-height: 620px;
}

.map-empty {
  padding: 24px;
  color: var(--muted);
}

@media (max-width: 640px) {
  .book-page .section-header-block {
    padding-bottom: 18px;
  }

  .book-page .section-header-block h1 {
    font-size: 25px;
    line-height: 1.32;
  }

  .book-page .section-header-block .lead {
    font-size: 15px;
    line-height: 1.68;
  }

  .book-page .panel > h2,
  .book-page .chart-panel-header h2 {
    font-size: 16px;
  }

  .book-chart {
    height: 330px;
  }

  .book-chart.policy-typology-chart,
  .book-chart.pyramid-panel-grid,
  .book-chart.cohort-panel-chart,
  .book-chart.elderly-labor-panel-chart,
  .book-chart.regional-slope-panel-chart,
  .book-chart.sido-migration-panel-chart {
    height: auto;
    min-height: 0;
  }

  .chart-panel-header {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .chart-panel-header .csv-button {
    align-self: flex-start;
  }

  .csv-button,
  .manuscript-edit-button {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .markdown-manuscript {
    gap: 15px;
  }

  .markdown-manuscript > p,
  .markdown-manuscript > ul,
  .book-narrative p:not(.kicker),
  .reading-note p {
    font-size: 15px;
    line-height: 1.78;
  }

  .markdown-manuscript > h2 {
    font-size: 17px;
  }

  .markdown-manuscript > h3 {
    font-size: 15px;
  }

  .pause-box {
    padding: 16px;
  }

  .pause-box-body p,
  .pause-box-body li {
    font-size: 14px;
  }
}

.markdown-figure {
  margin: 8px 0;
  padding: 14px;
  border: 1px solid rgba(15, 23, 42, .08);
  background: #fff;
}

.markdown-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.markdown-figure figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.pause-box {
  margin-top: 12px;
  padding: 22px 24px;
  border: 1px solid rgba(180, 83, 9, .24);
  border-left: 5px solid var(--amber);
  border-radius: 8px;
  background: #fffaf0;
}

.pause-box h2 {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.35;
}

.pause-box-body {
  display: grid;
  gap: 12px;
}

.pause-box-body p,
.pause-box-body li {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.75;
}

.pause-box-body ul {
  margin: 0;
  padding-left: 20px;
}

.pause-box-body strong {
  color: #92400e;
}

@media (max-width: 900px) {
  .pyramid-panel-grid {
    grid-template-columns: 1fr;
  }

  .pyramid-panel {
    padding: 10px;
  }

  .pyramid-svg {
    min-height: 280px;
  }

  .small-book-chart {
    height: 280px;
  }

  .sido-migration-panel-chart {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .migration-age-contribution-chart,
  .household-region-gap-chart {
    height: 520px;
    min-height: 520px;
  }

  .evidence-grid {
    grid-template-columns: 1fr;
  }

  .supplement-grid {
    grid-template-columns: 1fr;
  }

  .cohort-region-panel header,
  .cohort-region-pair,
  .elderly-labor-panel-chart,
  .regional-slope-panel-chart,
  .foreigner-definition-grid,
  .foreign-panel-grid {
    grid-template-columns: 1fr;
  }

  .cohort-region-panel header {
    display: grid;
  }

  .cohort-region-panel header span {
    text-align: left;
  }

  .evidence-item div {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .cohort-region-panel,
  .supplement-chart,
  .elderly-labor-panel,
  .regional-slope-panel,
  .foreigner-definition-card,
  .foreign-share-panel {
    padding: 10px;
  }

  .cohort-mini-svg,
  .elderly-labor-svg,
  .regional-slope-svg,
  .foreign-share-panel svg,
  .sido-migration-svg {
    min-width: 460px;
  }

  .cohort-region-pair,
  .elderly-labor-panel-chart,
  .regional-slope-panel-chart,
  .foreign-share-panel-chart,
  .sido-migration-panel-chart {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sigungu-slope-map-chart {
    min-height: 460px;
  }

  .sigungu-slope-map-svg {
    min-width: 500px;
  }

  .data-table {
    min-width: 720px;
    font-size: 13px;
  }

  .data-table th,
  .data-table td {
    padding: 9px 10px;
  }
}
