:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  --background: #07080b;
  --surface: #101218;
  --raised: #181c24;
  --text: #f2f4f8;
  --muted: #a5adbd;
  --accent: #f08a63;
  --line: #303641;
  --warning: #f5c479;
  background: var(--background);
  color: var(--text);
  scrollbar-color: var(--line) var(--background);
  text-underline-offset: 0.2em;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

::selection {
  color: var(--background);
  background: var(--accent);
}

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

a:hover {
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10;
  padding: 10px 18px;
  color: var(--background);
  background: var(--accent);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: none;
}

.masthead {
  min-height: 80px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.brand svg {
  color: var(--accent);
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
}

.brand span {
  margin-left: 8px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

.masthead-actions {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 14px;
}

.masthead-actions a {
  color: var(--text);
}

button {
  font: inherit;
  color: var(--text);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
}

button:hover {
  background: var(--raised);
}

.page-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 800px);
  gap: clamp(40px, 6vw, 104px);
  max-width: 1344px;
  margin: 0 auto;
  padding: 64px 48px 80px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 28px;
  max-height: calc(100dvh - 56px);
  overflow-y: auto;
  padding: 8px 8px 8px 0;
  font-size: 14px;
}

.contents summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 650;
  padding: 0 0 12px;
}

.contents nav {
  display: grid;
  gap: 3px;
}

.contents nav a {
  display: block;
  padding: 7px 10px;
  border-radius: 4px;
  color: var(--muted);
  line-height: 1.45;
  text-decoration: none;
}

.contents nav a:hover,
.contents nav a[aria-current="location"] {
  color: var(--accent);
  background: var(--surface);
}

.sidebar-note {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

main {
  min-width: 0;
}

.page-intro {
  padding: 0 0 56px;
}

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  text-wrap: balance;
}

h1 {
  margin: 0 0 24px;
  font-size: clamp(40px, 4.8vw, 64px);
  letter-spacing: -0.035em;
  font-weight: 750;
}

.intro {
  max-width: 56ch;
  font-size: 19px;
  line-height: 1.6;
  color: var(--muted);
}

.edition {
  margin: 24px 0;
  font-size: 14px;
  color: var(--muted);
}

.start-links {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 30px;
  font-size: 15px;
}

.primary-link {
  display: inline-block;
  padding: 10px 18px;
  color: var(--background);
  background: var(--accent);
  border-radius: 6px;
  text-decoration: none;
  font-weight: 650;
}

.primary-link:hover {
  color: var(--background);
  background: #ffad8c;
}

.guide-section {
  padding: 44px 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: 28px;
}

h2 {
  margin: 0 0 26px;
  font-size: 30px;
  letter-spacing: -0.025em;
}

h3 {
  margin: 36px 0 14px;
  font-size: 21px;
}

h4 {
  margin: 28px 0 12px;
  font-size: 17px;
}

p,
ul,
ol,
dl {
  max-width: 72ch;
  margin: 16px 0;
}

ul,
ol {
  padding-left: 25px;
}

li {
  margin: 10px 0;
  padding-left: 4px;
}

li::marker {
  color: var(--accent);
}

dt {
  font-weight: 650;
}

dd {
  margin: 4px 0 20px;
}

p,
li,
dd,
td,
th {
  overflow-wrap: anywhere;
}

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.88em;
}

:not(pre) > code {
  padding: 2px 5px;
  border-radius: 3px;
  background: var(--raised);
}

pre {
  max-width: 100%;
  margin: 22px 0;
  padding: 20px 22px;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.7;
  tab-size: 2;
}

pre code {
  font-size: inherit;
}

.callout {
  margin: 26px 0;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.callout > strong {
  color: var(--accent);
}

.callout.warning > strong {
  color: var(--warning);
}

.callout p {
  margin: 8px 0 0;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  margin: 22px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.6;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

caption {
  padding: 14px 18px;
  text-align: left;
  font-weight: 650;
  color: var(--text);
  background: var(--surface);
}

th,
td {
  min-width: 150px;
  padding: 14px 18px;
  vertical-align: top;
  border-top: 1px solid var(--line);
}

th {
  background: var(--surface);
  font-weight: 650;
}

td {
  color: var(--muted);
}

td:first-child {
  color: var(--text);
}

.guide-section details {
  margin: 24px 0;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.guide-section summary {
  color: var(--accent);
  font-weight: 650;
  cursor: pointer;
}

.guide-footer {
  border-top: 1px solid var(--line);
  padding: 36px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.guide-footer strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
}

.guide-footer > div {
  display: flex;
  gap: 24px;
  margin-top: 24px;
}

@media (max-width: 900px) {
  .masthead {
    padding-inline: 24px;
  }

  .page-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
    padding: 24px 24px 56px;
    max-width: 800px;
  }

  .sidebar {
    position: static;
    max-height: none;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-note {
    display: none;
  }

  .contents nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-intro {
    padding-bottom: 40px;
  }
}

@media (max-width: 480px) {
  .masthead {
    padding: 14px 20px;
    min-height: 68px;
    gap: 12px;
  }

  .brand {
    font-size: 17px;
  }

  .brand span,
  #print-guide {
    display: none;
  }

  .masthead-actions {
    gap: 0;
    font-size: 13px;
  }

  .page-layout {
    padding-inline: 20px;
  }

  .guide-section {
    padding-block: 36px;
  }

  h2 {
    font-size: 27px;
  }

  .callout {
    padding: 18px;
  }
}

@media print {
  :root {
    color-scheme: light;
    --background: #ffffff;
    --surface: #f5f5f5;
    --raised: #f0f0f0;
    --text: #111111;
    --muted: #333333;
    --accent: #8b3211;
    --line: #bbbbbb;
    --warning: #663900;
    font-size: 10pt;
  }

  .masthead,
  .sidebar,
  .start-links,
  .skip-link,
  .guide-footer > div {
    display: none;
  }

  .page-layout {
    display: block;
    max-width: none;
    padding: 0;
  }

  h1 {
    font-size: 32pt;
  }

  h2,
  h3,
  h4,
  summary {
    break-after: avoid;
  }

  pre,
  .table-wrap {
    overflow: visible;
  }

  pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  table {
    font-size: 9pt;
  }

  th,
  td {
    min-width: 0;
    padding: 8px;
  }

  tr,
  .callout {
    break-inside: avoid;
  }

  a {
    color: inherit;
  }
}
