:root {
  color-scheme: light dark;
  --accent: #087af5;
  --orange: #ff7900;
  --ink: #17212b;
  --muted: #5e6874;
  --paper: #f4f7fb;
  --surface: rgba(255, 255, 255, 0.88);
  --line: rgba(23, 33, 43, 0.14);
  --code: #eef2f7;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 1.5rem;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 82% 3%, rgba(255, 121, 0, 0.11), transparent 22rem),
    radial-gradient(circle at 8% 12%, rgba(8, 122, 245, 0.12), transparent 24rem),
    var(--paper);
  color: var(--ink);
  font: 17px/1.62 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.14em;
}

a:hover { text-decoration-thickness: 0.14em; }

.layout {
  display: grid;
  grid-template-columns: minmax(15rem, 19rem) minmax(0, 58rem);
  gap: clamp(1.5rem, 4vw, 4rem);
  width: min(100% - 2rem, 84rem);
  margin: 0 auto;
  padding: 2rem 0 5rem;
}

.sidebar {
  position: sticky;
  top: 1rem;
  align-self: start;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  padding: 1.2rem;
  background: var(--surface);
  box-shadow: 0 1rem 3rem rgba(34, 50, 68, 0.08);
  backdrop-filter: blur(24px);
}

.brand {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.5rem;
  aspect-ratio: 1;
  border-radius: 50% 50% 50% 16%;
  background: var(--orange);
  color: white;
  font-size: 1.3rem;
  transform: rotate(-15deg);
}

.brand-mark span { transform: rotate(15deg); }
.brand strong { display: block; font-size: 1.08rem; }
.brand small { color: var(--muted); }

.sidebar ol {
  display: grid;
  gap: 0.18rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
}

.chapter-menu summary {
  display: none;
  cursor: pointer;
  color: var(--accent);
  font-weight: 650;
  list-style: none;
}

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

.sidebar a {
  display: block;
  border-radius: 0.7rem;
  padding: 0.42rem 0.58rem;
  color: var(--ink);
  text-decoration: none;
}

.sidebar a:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
}

.document {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 2rem;
  padding: clamp(1.35rem, 4vw, 4rem);
  background: var(--surface);
  box-shadow: 0 1.5rem 4rem rgba(34, 50, 68, 0.09);
}

.publication-note {
  border-left: 0.3rem solid var(--orange);
  border-radius: 0.7rem;
  margin: 0 0 3rem;
  padding: 0.85rem 1rem;
  background: color-mix(in srgb, var(--orange) 8%, transparent);
  color: var(--muted);
  font-size: 0.92rem;
}

.chapter + .chapter {
  border-top: 1px solid var(--line);
  margin-top: 5rem;
  padding-top: 4rem;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  line-height: 1.15;
  text-wrap: balance;
}

h1 { margin: 0 0 1.2rem; font-size: clamp(2.35rem, 6vw, 4.4rem); letter-spacing: -0.045em; }
h2 { margin: 0 0 1.6rem; font-size: clamp(1.8rem, 4vw, 3rem); letter-spacing: -0.035em; }
h3 { margin: 3.2rem 0 1rem; font-size: clamp(1.35rem, 3vw, 2rem); letter-spacing: -0.025em; }
h4 { margin: 2.4rem 0 0.8rem; font-size: 1.26rem; }
h5, h6 { margin: 2rem 0 0.7rem; font-size: 1.08rem; }

p, li { max-width: 74ch; }
li + li { margin-top: 0.34rem; }

blockquote {
  margin: 1.6rem 0;
  border-left: 0.28rem solid var(--accent);
  border-radius: 0 0.8rem 0.8rem 0;
  padding: 0.85rem 1.1rem;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

blockquote > :first-child { margin-top: 0; }
blockquote > :last-child { margin-bottom: 0; }

table {
  display: block;
  width: 100%;
  margin: 1.5rem 0 2rem;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 0.72rem 0.82rem;
  text-align: left;
  vertical-align: top;
}

th { background: color-mix(in srgb, var(--accent) 6%, transparent); }

code {
  border-radius: 0.35rem;
  padding: 0.08rem 0.3rem;
  background: var(--code);
  color: var(--ink);
  font: 0.9em ui-monospace, SFMono-Regular, Menlo, monospace;
}

pre {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  padding: 1rem;
  background: var(--code);
}

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

figure {
  width: min(100%, 28rem);
  margin: 2rem auto;
  text-align: center;
}

figure img {
  display: block;
  max-width: 100%;
  max-height: 49rem;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background: #fff;
  box-shadow: 0 0.8rem 2.4rem rgba(34, 50, 68, 0.13);
}

figcaption {
  margin-top: 0.72rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.42;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f4f7fb;
    --muted: #b9c1cb;
    --paper: #0b1118;
    --surface: rgba(20, 29, 39, 0.9);
    --line: rgba(255, 255, 255, 0.14);
    --code: #1a2530;
  }
}

@media (max-width: 900px) {
  .layout { display: block; width: min(100% - 1rem, 58rem); padding-top: 0.5rem; }
  .sidebar {
    position: sticky;
    z-index: 10;
    top: 0.5rem;
    max-height: calc(100vh - 1rem);
    margin-bottom: 0.75rem;
    border-radius: 1.35rem;
    padding: 0.85rem 1rem;
  }
  .brand { margin-bottom: 0.45rem; }
  .chapter-menu summary {
    display: block;
    border-top: 1px solid var(--line);
    padding: 0.65rem 0 0.1rem;
  }
  .chapter-menu summary::after {
    float: right;
    content: "＋";
  }
  .chapter-menu[open] summary::after { content: "−"; }
  .chapter-menu ol { margin-top: 0.5rem; }
  .sidebar ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .document { border-radius: 1.35rem; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .sidebar ol { grid-template-columns: 1fr; }
  .document { padding: 1.15rem; }
  h1 { font-size: 2.5rem; }
  h2 { font-size: 2rem; }
  th, td { padding: 0.62rem; }
}

@page {
  size: A4;
  margin: 17mm 16mm 19mm;
}

@media print {
  :root {
    color-scheme: light;
    --ink: #111820;
    --muted: #4d5966;
    --paper: white;
    --surface: white;
    --line: rgba(17, 24, 32, 0.18);
    --code: #f2f4f7;
  }

  body { background: white; font-size: 10.5pt; line-height: 1.47; }
  .layout { display: block; width: auto; margin: 0; padding: 0; }
  .sidebar { display: none; }
  .document { border: 0; border-radius: 0; padding: 0; box-shadow: none; }
  .publication-note { margin-bottom: 14mm; }
  .chapter + .chapter { break-before: page; border: 0; margin-top: 0; padding-top: 0; }
  body.quick-start-print .chapter:not(#chapter-index):not(#chapter-quick-start) {
    display: none;
  }
  h1 { font-size: 28pt; }
  h2 { font-size: 23pt; }
  h3 { margin-top: 8mm; font-size: 16pt; break-after: avoid-page; }
  h4 { margin-top: 6mm; font-size: 13pt; break-after: avoid-page; }
  h5, h6 { break-after: avoid-page; }
  table { display: table; overflow: visible; font-size: 8.6pt; break-inside: avoid; }
  thead { display: table-header-group; }
  tr, blockquote, pre { break-inside: avoid; }
  figure { width: min(100%, 92mm); margin: 6mm auto; break-inside: avoid; }
  figure img { max-height: 178mm; border-radius: 3mm; box-shadow: none; }
  figcaption { font-size: 8pt; }
  a { color: inherit; text-decoration: none; }
  p, li { orphans: 3; widows: 3; }
}
