html,
body {
  overflow: auto;
}

.doc {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
  line-height: 1.55;
  font-size: 0.95rem;
}

.doc h1 {
  margin: 0 0 0.75rem;
  font-size: 1.65rem;
}

.doc h2 {
  margin: 1.75rem 0 0.65rem;
  font-size: 1.1rem;
  font-weight: 650;
}

.doc h3 {
  margin: 1.25rem 0 0.45rem;
  font-size: 1rem;
  font-weight: 650;
}

.doc p,
.doc ol,
.doc ul {
  margin: 0 0 0.75rem;
  color: var(--text);
}

.doc ol,
.doc ul {
  padding-left: 1.35rem;
}

.doc li + li {
  margin-top: 0.35rem;
}

.doc hr {
  margin: 1.25rem 0;
  border: none;
  border-top: 1px solid var(--line);
}

.doc-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  margin: 0 0 1rem;
  -webkit-overflow-scrolling: touch;
}

.doc table {
  width: 100%;
  min-width: 20rem;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.doc th,
.doc td {
  border: 1px solid var(--line);
  padding: 0.35rem 0.55rem;
  text-align: left;
  vertical-align: top;
  min-width: 0; /* table-layout: fixed — иначе nowrap из styles.css не даёт перенос */
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
}

.doc th code,
.doc td code {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.doc th {
  background: var(--bg2);
}

/* 2 колонки: файл | описание */
.doc table:has(thead th:nth-child(2):last-child) th:nth-child(1),
.doc table:has(thead th:nth-child(2):last-child) td:nth-child(1) {
  width: 36%;
}

/* 3 колонки: задача | да/нет | комментарий */
.doc table:has(thead th:nth-child(3):last-child) th:nth-child(1),
.doc table:has(thead th:nth-child(3):last-child) td:nth-child(1) {
  width: 38%;
}

.doc table:has(thead th:nth-child(3):last-child) th:nth-child(2),
.doc table:has(thead th:nth-child(3):last-child) td:nth-child(2) {
  width: 12%;
}

.doc table:has(thead th:nth-child(3):last-child) th:nth-child(3),
.doc table:has(thead th:nth-child(3):last-child) td:nth-child(3) {
  width: 50%;
}

/* 4 колонки: параметр | обяз. | по умолчанию | описание */
.doc table:has(thead th:nth-child(4):last-child) th:nth-child(1),
.doc table:has(thead th:nth-child(4):last-child) td:nth-child(1) {
  width: 11.5rem;
}

.doc table:has(thead th:nth-child(4):last-child) th:nth-child(2),
.doc table:has(thead th:nth-child(4):last-child) td:nth-child(2) {
  width: 3.75rem;
  text-align: center;
}

.doc table:has(thead th:nth-child(4):last-child) th:nth-child(3),
.doc table:has(thead th:nth-child(4):last-child) td:nth-child(3) {
  width: 8.5rem;
}

.doc pre {
  margin: 0;
  padding: 0.75rem 0.85rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 0 0.25rem 0.25rem 0;
  background: var(--bg1);
  font-size: 0.82rem;
  line-height: 1.45;
}

.doc code {
  color: #c5d4e3;
  font-size: 0.9em;
}

.doc :not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: 0.2rem;
  background: var(--bg2);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.doc a {
  color: var(--accent);
}

.doc .back {
  margin-bottom: 1rem;
  font-size: 0.88rem;
}

.doc-meta {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.doc-meta a + a::before {
  content: ' · ';
}

.doc-code {
  position: relative;
  margin: 0 0 1rem;
}

.doc-code pre {
  padding: 0.75rem 2.4rem 0.75rem 0.85rem;
}

.doc-code__copy {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 0.2rem;
  background: var(--bg2);
  color: var(--muted);
  cursor: default;
}

.doc-code__copy:hover {
  color: var(--text);
  background: var(--bg1);
}

.doc-code__copy--done {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 55%, var(--line));
}

.doc-error {
  color: #f0a8a8;
}
