:root {
  color-scheme: light;
  --paper: #fff;
  --ink: #5a5a5a;
  --heading: #333;
  --muted: #777;
  --line: #eee;
  --accent: #428bca;
  --accent-dark: #0f2350;
  --accent-secondary: #414fa3;
  --accent-soft: #edf3f8;
  --nav: #222;
  --code: #f8f8f8;
  font-family: Oxygen, "Yu Gothic", YuGothic, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; padding-top: 50px; color: var(--ink); background: var(--paper); font-size: 1.05rem; line-height: 1.75; }
a { color: var(--accent); text-underline-offset: 0.16em; }
a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 0.2rem; border-radius: 0.15rem; }
.skip-link { position: fixed; top: 0.5rem; left: 0.5rem; z-index: 20; padding: 0.55rem 0.8rem; border-radius: 4px; background: white; color: var(--nav); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.site-header { position: fixed; top: 0; right: 0; left: 0; z-index: 10; min-height: 50px; background: var(--nav); }
.site-header nav { display: flex; align-items: stretch; max-width: 73.125rem; min-height: 50px; margin: auto; padding: 0 0.95rem; font-size: 1rem; }
.site-header a { display: flex; align-items: center; padding: 0.78rem 0.95rem; color: #ccc; line-height: 1.25; text-decoration: none; }
.site-header a:hover { color: white; background: #080808; }
.site-header .site-brand { margin-left: -1.9rem; color: white; font-size: 1.05rem; font-weight: 400; }
.book-page { max-width: 54rem; min-height: 75vh; margin: 0 auto; padding: 4rem 1.5rem 6rem; }
.home-page { max-width: 71.25rem; padding-top: 0; }
.book-page > h1:first-child { margin-top: 0; }
h1, h2, h3, h4, h5 { color: var(--heading); font-family: Oxygen, "Yu Gothic", YuGothic, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif; font-weight: 400; line-height: 1.2; scroll-margin-top: 5rem; }
h1 { margin: 0 0 2.8rem; font-size: clamp(2.25rem, 5vw, 3rem); }
h2 { margin: 4.5rem 0 1.4rem; padding-top: 0.7rem; border-top: 1px solid var(--line); font-size: 1.8rem; }
h3 { margin: 3rem 0 1rem; font-size: 1.34rem; }
h4 { margin: 2.4rem 0 0.8rem; font-size: 1.08rem; }
h5 { margin: 2rem 0 0.5rem; font-size: 1rem; }
.heading-number { display: block; margin-bottom: 0.45rem; color: var(--accent); font: 700 0.85rem/1 Oxygen, sans-serif; letter-spacing: 0.08em; }
p { margin: 0 0 1.25rem; }
code { padding: 0.08em 0.28em; border-radius: 3px; background: var(--code); font: 0.88em/1.45 "Oxygen Mono", Consolas, monospace; overflow-wrap: anywhere; }
.inline-code { padding: 0.08em 0.28em; border-radius: 3px; background: var(--code); font: 0.88em/1.45 "Oxygen Mono", Consolas, monospace; }
.listing { overflow-x: auto; margin: 1.6rem 0 2rem; padding: 1.15rem 1.25rem; border: 1px solid var(--line); border-radius: 0; background: white; line-height: 1.52; tab-size: 2; }
.listing code { padding: 0; background: none; color: #222; font-family: "Oxygen Mono", Consolas, monospace; font-size: 0.84rem; overflow-wrap: normal; }
.math-display { overflow-x: auto; margin: 1.8rem 0; padding: 0.5rem; text-align: center; }
.callout { margin: 2rem 0; padding: 1.4rem 1.5rem 0.1rem; border-left: 4px solid var(--accent-dark); border-radius: 0 4px 4px 0; background: var(--accent-soft); }
figure { margin: 2.5rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: 4px; }
figure img { display: block; max-width: 100%; height: auto; margin: auto; }
figcaption { margin: 0.8rem 0 0; color: var(--muted); font-size: 0.9rem; text-align: center; }
.subfigure { margin: 1rem 0; }
.center { text-align: center; }
.flushright { text-align: right; }
.small { font-size: 0.88em; }
.boxed { display: inline-block; padding: 0.15rem 0.4rem; border: 1px solid currentColor; }
ul, ol { margin: 1rem 0 1.5rem; padding-left: 1.6rem; }
li { margin-bottom: 0.45rem; }
.table-scroll { overflow-x: auto; margin: 1.5rem 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
td, th { padding: 0.55rem 0.7rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.footnote { display: inline; color: var(--muted); font-size: 0.82em; }
.footnote::before { content: " ["; }
.footnote::after { content: "]"; }
.anchor { position: relative; top: -5rem; }
.missing-reference { color: #a13b32; }
.site-language { max-width: 73.125rem; margin: 1rem auto 0; padding: 1rem 0.95rem 1.4rem; color: var(--ink); font-size: 0.95rem; }
.site-language span { margin-right: 0.35rem; }
footer { max-width: none; margin: 0; padding: 0.75rem 0; background: var(--nav); color: white; font-size: 0.9rem; }
.footer-inner { max-width: 73.125rem; margin: auto; padding: 0 0.95rem; }
footer a { color: var(--accent); }
.eyebrow { color: var(--accent-dark); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.author { color: var(--muted); }
.home-hero { position: relative; padding: clamp(3.5rem, 7vw, 5.5rem) 0; background: var(--accent-dark); box-shadow: 0 0 0 100vmax var(--accent-dark); color: white; clip-path: inset(0 -100vmax); }
.home-hero h1 { max-width: 17em; margin: 0.5rem 0 1.4rem; color: white; font-size: clamp(2.5rem, 5.5vw, 4.2rem); font-weight: 400; }
.home-hero .eyebrow { color: #bac7e2; }
.hero-summary { max-width: 49rem; color: white; font-size: clamp(1.08rem, 2vw, 1.3rem); font-weight: 300; line-height: 1.55; }
.home-hero .author { margin-top: 1.6rem; color: #c8d0df; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 2rem; }
.button { display: inline-flex; min-height: 2.5rem; align-items: center; justify-content: center; padding: 0.55rem 0.9rem; border: 1px solid transparent; border-radius: 4px; font-size: 0.94rem; font-weight: 400; text-decoration: none; }
.button-primary { border-color: #091340; background: var(--accent-dark); color: white; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28); }
.button-primary:hover { border-color: #06102f; background: #091940; }
.button-secondary { border-color: #313f93; background: var(--accent-secondary); color: white; }
.button-secondary:hover { background: #33418e; }
.home-about { padding: clamp(3.5rem, 7vw, 5.5rem) 0; border-bottom: 1px solid var(--line); }
.home-about h2, .contents > h2 { margin: 0.45rem 0 1.4rem; padding: 0; border: 0; font-size: clamp(2rem, 4vw, 2.7rem); font-weight: 400; }
.about-copy { max-width: 49rem; margin: 0 auto; text-align: center; }
.about-copy > p:last-child { color: var(--ink); font-size: 1.05rem; }
.topic-panel { margin-top: 3rem; }
.topic-panel > .eyebrow { text-align: center; }
.topic-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.75rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
.topic-list li { margin: 0; text-align: center; }
.topic-number { display: inline-flex; width: 3rem; height: 3rem; align-items: center; justify-content: center; margin-bottom: 0.7rem; border-radius: 50%; background: var(--accent-dark); color: white; font-size: 0.82rem; font-weight: 700; letter-spacing: 0.08em; }
.topic-list h3 { margin: 0 0 0.6rem; font-size: 1.45rem; }
.topic-list p { margin: 0; color: var(--muted); font-size: 0.94rem; line-height: 1.55; }
.contents { padding-top: clamp(3.5rem, 7vw, 5.5rem); scroll-margin-top: 4rem; }
.toc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 4rem; align-items: start; }
.toc-part { margin: 2.5rem 0; }
.toc-part h2 { margin: 0 0 0.7rem; padding: 0; border: 0; color: var(--accent-dark); font-size: 0.82rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.toc-part ol { margin: 0; padding: 0; list-style: none; }
.toc-part li { margin: 0; border-top: 1px solid var(--line); }
.toc-part a { display: grid; grid-template-columns: 2.4rem 1fr; gap: 0.75rem; padding: 0.75rem 0; color: var(--heading); text-decoration: none; }
.toc-part a:hover { color: var(--accent); }
.toc-number { color: var(--accent); font-weight: 700; }
.toc-extras { grid-column: 1 / -1; }
.bibliography li { margin-bottom: 1rem; }
.index-list { display: grid; grid-template-columns: minmax(8rem, 15rem) 1fr; gap: 0.3rem 1rem; }
.index-list dt { font-weight: 650; }
.index-list dd { margin: 0; color: var(--muted); }
.language-picker { display: grid; place-content: center; min-height: 100vh; padding: 2rem; background: var(--accent-dark); color: white; text-align: center; }
.language-picker h1 { margin: 0.2rem 0 2.2rem; color: white; font-size: clamp(2rem, 7vw, 4rem); }
.language-picker .eyebrow { color: #bac7e2; }
.language-lead { margin: -1.2rem 0 2rem; color: #c8d0df; }
.language-picker div { display: flex; gap: 1rem; justify-content: center; }
.language-picker a { min-width: 8rem; padding: 0.65rem 1.1rem; border: 1px solid #313f93; border-radius: 4px; background: var(--accent-secondary); color: white; text-decoration: none; }
.language-picker a:hover { border-color: white; background: #33418e; }

@media (max-width: 768px) {
  .site-header nav { overflow-x: auto; padding-inline: 0.35rem; white-space: nowrap; scrollbar-width: none; }
  .site-header nav::-webkit-scrollbar { display: none; }
  .site-header a { padding-inline: 0.7rem; }
  .site-header .site-brand { margin-left: -0.35rem; }
  .book-page { padding: 3rem 1rem 4rem; }
  .home-page { padding-top: 0; }
  h1 { font-size: 2.35rem; }
  h2 { margin-top: 3.5rem; }
  .home-hero { padding-block: 3.5rem; }
  .home-hero h1 { max-width: 11em; font-size: clamp(2.4rem, 11vw, 3.5rem); }
  .topic-list { grid-template-columns: 1fr; gap: 2.5rem; }
  .topic-list p { max-width: 28rem; margin-inline: auto; }
  .toc-grid { grid-template-columns: 1fr; }
  .toc-extras { grid-column: auto; }
  .index-list { grid-template-columns: 1fr; }
  .index-list dd { margin-bottom: 0.7rem; }
}

@media print {
  body { padding-top: 0; }
  .site-header, .site-language, footer { display: none; }
  .book-page { max-width: none; padding: 0; }
  a { color: inherit; text-decoration: none; }
}
