:root {
  --color-primary: #235ec4;
  --color-emphasis: #d32f2f;
  --color-text: #212121;
  --color-muted: #616161;
  --color-border: #e0e0e0;
  --color-header: #f5f5f5;
  --toc-width: 300px;
}

body {
  margin: 0;
  color: var(--color-text);
  background: #ffffff;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans CJK JP", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

a {
  color: var(--color-primary);
}

.cover,
main {
  box-sizing: border-box;
  max-width: 1000px;
  padding-inline: 16px;
}

.cover {
  padding-block: 48px;
  text-align: center;
}

.cover p {
  margin: 4px 0;
}

.logo {
  width: 240px;
  height: auto;
}

.cover-title {
  font-size: 2rem;
  font-weight: bold;
}

.cover .cover-publisher {
  margin-top: 24px;
}

.pdf-link a {
  display: inline-block;
  margin-top: 16px;
  padding: 6px 16px;
  border: 1px solid var(--color-primary);
  border-radius: 4px;
  text-decoration: none;
}

.toc {
  box-sizing: border-box;
  padding: 16px;
  border-block: 1px solid var(--color-border);
  font-size: 0.9rem;
}

.toc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.toc-title {
  margin: 0 auto 0 0;
  font-weight: bold;
}

.toc-button {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: #ffffff;
  color: var(--color-primary);
  cursor: pointer;
}

.toc-button:hover {
  background: var(--color-header);
}

.js .toc-chapters {
  display: flex;
}

.toc-chapters::before {
  content: "";
  box-sizing: border-box;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 2px;
  background: linear-gradient(currentColor, currentColor) center / 6px 2px no-repeat;
}

.toc-chapters[data-action="expand"]::before {
  background:
    linear-gradient(currentColor, currentColor) center / 6px 2px no-repeat,
    linear-gradient(currentColor, currentColor) center / 2px 6px no-repeat;
}

.toc-toggle::before {
  content: "";
  box-sizing: border-box;
  width: 18px;
  height: 14px;
  border: 2px solid currentColor;
  border-left-width: 7px;
  border-radius: 2px;
}

.toc ol {
  margin: 0;
  padding-left: 1.2em;
}

.toc > ol {
  padding-left: 0;
  list-style: none;
}

.toc > ol > li {
  margin-top: 8px;
  padding-left: 1em;
  font-weight: bold;
}

.toc li li {
  font-weight: normal;
}

.toc summary {
  position: relative;
  list-style: none;
  cursor: pointer;
}

.toc summary::-webkit-details-marker {
  display: none;
}

.toc summary::before {
  content: "";
  position: absolute;
  top: 0.55em;
  left: -0.9em;
  border-block: 0.3em solid transparent;
  border-left: 0.45em solid currentColor;
}

.toc details[open] > summary::before {
  transform: rotate(90deg);
}

.toc a {
  text-decoration: none;
}

.toc a:hover {
  text-decoration: underline;
}

.toc a[aria-current] {
  background: var(--color-primary);
  color: #ffffff;
}

.toc-page {
  display: none;
}

.chapter ul {
  margin: 6px 0;
  padding-left: 1.5em;
}

.chapter li ul {
  margin: 4px 0 0;
}

.chapter li > p {
  margin: 0;
}

.chapter li + li,
.chapter li > p + p {
  margin-top: 4px;
}

h1 {
  margin: 48px 0 16px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--color-primary);
  font-size: 1.6rem;
}

h2 {
  margin: 40px 0 12px;
  padding-left: 8px;
  border-left: 4px solid var(--color-primary);
  font-size: 1.25rem;
}

h3 {
  margin: 24px 0 8px;
  font-size: 1.05rem;
}

h1,
h2,
h3 {
  scroll-margin-top: 16px;
}

.block > p {
  margin: 6px 0;
}

.block + .block {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.block + .block > :first-child {
  margin-top: 0;
}

img {
  height: 1.4em;
  width: auto;
  vertical-align: middle;
}

figure {
  margin: 16px 0;
}

figure img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--color-border);
}

figcaption {
  margin-top: 4px;
  font-size: 0.85rem;
}

mark {
  background: none;
  color: var(--color-emphasis);
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  font-size: 0.85rem;
}

th,
td {
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
  overflow-wrap: normal;
}

td {
  min-width: 6em;
}

td:first-child:nth-last-child(2) {
  white-space: nowrap;
}

#revisions + .table-wrap td:not(:last-child) {
  white-space: nowrap;
}

th {
  background: var(--color-header);
  white-space: nowrap;
}

.copyright {
  margin-top: 48px;
  color: var(--color-muted);
  font-size: 0.8rem;
  text-align: center;
}

.language-select {
  margin-inline: auto;
  padding-block: 64px;
  text-align: center;
}

.language-select ul {
  padding: 0;
  list-style: none;
  font-size: 1.2rem;
}

.language-select li {
  margin: 8px 0;
}

@media (min-width: 960px) {
  body:has(> .toc) {
    display: grid;
    grid-template-columns: var(--toc-width) minmax(0, 1fr);
    grid-template-areas:
      "toc cover"
      "toc main";
    align-items: start;
  }

  .cover {
    grid-area: cover;
  }

  .cover,
  main {
    padding-inline: 40px;
  }

  .toc {
    grid-area: toc;
    grid-row: 1 / span 2;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding-top: 0;
    border-block: none;
    border-right: 1px solid var(--color-border);
  }

  .toc-header {
    position: sticky;
    top: 0;
    margin-bottom: 0;
    padding-block: 16px 8px;
    background: #ffffff;
  }

  main {
    grid-area: main;
  }

  .js .toc-toggle {
    display: flex;
  }

  .toc-hidden body:has(> .toc) {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .toc-hidden .toc {
    padding-inline: 8px;
  }

  .toc-hidden .cover,
  .toc-hidden main {
    max-width: 1200px;
    margin-inline: auto;
  }

  .toc-hidden .toc-title,
  .toc-hidden .toc-chapters,
  .toc-hidden .toc > ol {
    display: none;
  }
}

@media print {
  body {
    font-size: 11pt;
    line-height: 1.55;
  }

  body:has(> .toc) {
    display: block;
  }

  .pdf-link,
  .js .toc-button {
    display: none;
  }

  .toc {
    break-before: page;
    padding: 0;
    border: none;
    font-size: 9pt;
  }

  .toc > ol {
    columns: 2;
  }

  .toc > ol > li {
    padding-left: 0;
    break-inside: avoid;
  }

  .toc li ol {
    padding-left: 2em;
  }

  .toc-entry {
    display: flex;
    align-items: last baseline;
    gap: 8px;
  }

  .toc-page:not(:empty) {
    display: inline;
    flex-shrink: 0;
    margin-left: auto;
  }

  .toc summary::before {
    display: none;
  }

  .cover,
  main {
    max-width: none;
    padding-inline: 0;
  }

  .cover {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 240mm;
  }

  .chapter {
    break-before: page;
  }

  h1 {
    margin-top: 0;
  }

  h2 {
    margin-top: 24px;
  }

  h1,
  h2,
  h3 {
    break-after: avoid;
  }

  .block,
  figure,
  tr {
    break-inside: avoid;
  }

  .block + .block {
    margin-top: 16px;
    padding-top: 0;
    border-top: none;
  }

  figure {
    margin: 8px 0;
  }

  figure img {
    width: auto;
    max-height: 107mm;
  }

  .chapter li {
    break-inside: avoid;
  }

  .table-wrap {
    overflow: visible;
  }

  .copyright {
    margin-top: 16px;
    break-before: avoid;
  }

  td {
    min-width: 0;
  }
}
