:root {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #f6f8f7;
  --panel-strong: #e8f1ee;
  --text: #1d2422;
  --muted: #5d6965;
  --line: #d6dfdc;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --code: #f2f5f4;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Yu Gothic", "Meiryo", system-ui, sans-serif;
  line-height: 1.75;
}

a {
  color: var(--accent-strong);
}

a:focus,
button:focus {
  outline: 3px solid #9ad7d1;
  outline-offset: 2px;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.site-header__inner,
.manual-layout,
.site-footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header__inner {
  padding: 28px 0 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.2;
}

.lead {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
}

.header-links,
.download-list,
.chapter-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.header-links {
  margin: 20px 0 0;
}

.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
}

.button-link.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.manual-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 32px;
  padding: 32px 0 44px;
}

.toc {
  align-self: start;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.toc h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.toc ol {
  margin: 0;
  padding-left: 1.4rem;
}

.toc li {
  margin: 0.25rem 0;
}

.manual-content {
  min-width: 0;
}

.manual-content > section {
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.manual-content > section:first-child {
  border-top: 0;
  padding-top: 0;
}

.manual-content h2 {
  margin: 0 0 14px;
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  line-height: 1.35;
}

.manual-content h3 {
  margin: 28px 0 8px;
  font-size: 1.25rem;
}

.manual-content h4 {
  margin: 22px 0 8px;
  font-size: 1.05rem;
}

.manual-content p,
.manual-content ul,
.manual-content ol {
  margin: 0 0 1rem;
}

.manual-content li {
  margin: 0.25rem 0;
}

.back-to-toc {
  margin: -6px 0 18px;
  font-size: 0.92rem;
}

.notice {
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  background: var(--panel-strong);
}

.table-wrap,
.code-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 14px 0 20px;
}

table {
  min-width: 560px;
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  padding: 9px 10px;
  border: 1px solid var(--line);
  vertical-align: top;
}

th {
  background: var(--panel-strong);
  text-align: left;
}

pre {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--code);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre;
}

code {
  padding: 0.1em 0.28em;
  border-radius: 4px;
  background: var(--code);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.94em;
}

pre code {
  padding: 0;
  background: transparent;
}

.downloads {
  margin: 0 0 28px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.downloads h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.site-footer {
  padding: 24px 0 36px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 820px) {
  .manual-layout {
    display: block;
    padding-top: 20px;
  }

  .toc {
    position: static;
    max-height: none;
    margin-bottom: 24px;
  }

  .site-header__inner,
  .manual-layout,
  .site-footer {
    width: min(100% - 24px, 1120px);
  }
}

@media print {
  html {
    scroll-behavior: auto;
  }

  body {
    color: #000;
    background: #fff;
    font-size: 10.5pt;
    line-height: 1.5;
  }

  .site-header,
  .toc,
  .downloads,
  .site-footer,
  .back-to-toc {
    position: static;
    border: 0;
    background: transparent;
  }

  .header-links,
  .downloads {
    display: none;
  }

  .manual-layout {
    display: block;
    width: 100%;
    padding: 0;
  }

  .manual-content > section {
    break-inside: avoid-page;
    border-top: 0;
  }

  a {
    color: #000;
    text-decoration: underline;
  }
}
