/* =========================================================
   ТРАНСЛИТ ОНЛАЙН (/tools/translit)
   Палитра и переменные — из style.css, префикс классов — tl-.

   Дизайн-план. Тот же язык, что у «Сжать изображение»: белая
   карточка → серые поля → белые элементы поверх. Инструмент
   читается сверху вниз как переводчик:
     1. направление (как пара языков) и стандарт (кнопки + меню);
     2. полоса с основанием стандарта — откуда правила и можно ли
        вернуть текст обратно;
     3. два поля рядом: ввод и результат; неоднозначные слова
        результата подчёркнуты и раскрывают варианты;
     4. переключатели — общий «заглавными» и опции стандарта;
     5. вкладки «все стандарты», «разбор по буквам», «МЧЗ».
   Кнопки — три вида: primary (зелёная, одна — «Скопировать»),
   line (белая с обводкой), quiet. Активный выбор — белая плашка
   с зелёной обводкой. Раскладка переключается по ширине самого
   инструмента (контейнерные запросы): сайдбар сайта в 332 px
   делает медиазапросы по окну неточными.
   ========================================================= */

[hidden] { display: none !important; }

/* Мелкий текст и ссылки темнее общих токенов сайта: контраст не ниже
   4,5:1 (WCAG AA) и на белом, и на сером поле; кольцо выбора — 3:1 */
.tl-tool, .tl-seo, .tl-toc {
  --tl-muted: #557479;
  --tl-link: #0E7F47;
  --tl-ring: #12A05C;
  --tl-field: #F2F4F6;
  --tl-field-hover: #E9EDF0;
  --tl-line: #E3E7EB;
  --tl-line-strong: #D3D9DF;
  --tl-tint: #EEF8F2;
  --tl-warn: #8A5A0F;
  --tl-warn-bg: #FFF5E3;
}

/* ---------- Карточка инструмента ---------- */
.tl-tool {
  position: relative;
  margin: 0 0 40px;
  padding: 24px;
  background: var(--color-surface);
  border-radius: 24px;
  box-shadow: 0 1px 2px rgba(16, 20, 24, 0.04);
  container: tltool / inline-size;
}

.tl-tool button { font-family: inherit; }
.tl-tool :focus-visible { outline: 2px solid var(--tl-ring); outline-offset: 2px; }

/* ---------- Шапка: направление и стандарт ---------- */
.tl-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
}

.tl-dir {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--tl-field);
  border-radius: 12px;
  flex-shrink: 0;
}
.tl-lang {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 104px;
  height: 36px;
  padding: 0 14px;
  border-radius: 9px;
  background: var(--color-surface);
  box-shadow: 0 1px 2px rgba(16, 20, 24, 0.08), 0 0 0 0.5px rgba(16, 20, 24, 0.06);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-strong);
  white-space: nowrap;
}
.tl-swap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 36px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}
.tl-swap i { font-size: 18px; line-height: 1; transition: transform 0.25s ease; }
.tl-swap:hover { background: var(--color-surface); color: var(--tl-link); }
.tl-tool.is-reverse .tl-swap i { transform: rotate(180deg); }

.tl-std {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1 1 100%;
}
/* Подпись стоит по первой строке кнопок, даже когда они переносятся */
.tl-std-label { flex-shrink: 0; line-height: 36px; font-size: 13px; font-weight: 600; color: var(--color-text-strong); white-space: nowrap; }
.tl-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.tl-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 13px;
  border: 0;
  border-radius: 10px;
  background: var(--tl-field);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--transition-fast), box-shadow var(--transition-fast), color var(--transition-fast);
}
.tl-chip:hover { background: var(--tl-field-hover); color: var(--color-text-strong); }
.tl-chip.is-active {
  background: var(--color-surface);
  color: var(--color-text-strong);
  font-weight: 600;
  box-shadow: inset 0 0 0 2px var(--tl-ring);
}
.tl-more-short { display: none; }
.tl-chip--more i { font-size: 16px; line-height: 1; margin-right: -3px; transition: transform var(--transition-fast); }
.tl-chip--more[aria-expanded="true"] i { transform: rotate(180deg); }

/* Меню всех стандартов: под кнопкой «Все стандарты» (позицию ставит
   translit.js), в две колонки — все 10 стандартов видны без прокрутки */
.tl-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(640px, 100%);
  max-height: min(78vh, 640px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  background: var(--color-surface);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(16, 20, 24, 0.16), 0 0 0 1px var(--tl-line);
}
.tl-menu-col { min-width: 0; }
.tl-menu-col + .tl-menu-col { padding-left: 6px; margin-left: 6px; border-left: 1px solid var(--tl-line); }
.tl-menu-group + .tl-menu-group { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--tl-line); }
.tl-menu-title {
  margin: 0;
  padding: 10px 10px 4px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tl-muted);
}
.tl-menu-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  column-gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.tl-menu-item:hover { background: var(--tl-field); }
.tl-menu-item[aria-checked="true"] { background: var(--tl-tint); }
.tl-menu-name { grid-column: 1; font-size: 14px; font-weight: 600; color: var(--color-text-strong); }
.tl-menu-tag { grid-column: 1; font-size: 12.5px; color: var(--tl-muted); }
.tl-menu-check { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 18px; color: var(--tl-link); opacity: 0; }
.tl-menu-item[aria-checked="true"] .tl-menu-check { opacity: 1; }

/* ---------- Сведения о стандарте ---------- */
.tl-info {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--tl-tint);
  border-radius: 14px;
}
.tl-info-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0; }
.tl-info-title strong { font-size: 15px; font-weight: 700; color: var(--color-text-strong); }
.tl-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(16, 20, 24, 0.06);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}
.tl-badge.is-exact { background: #D6F5E4; color: #0B6B3C; }
.tl-badge.is-smart { background: #E4EEF7; color: #2A4D6B; }
.tl-badge.is-loading { background: #FFF1D6; color: var(--tl-warn); }
.tl-info-about { margin: 6px 0 0; font-size: 14px; line-height: 1.6; color: var(--color-text); }
.tl-info-basis {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 6px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--tl-muted);
}
.tl-info-basis i { font-size: 14px; line-height: 1.3; }

/* ---------- Поля ---------- */
.tl-panes {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 16px;
}
.tl-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 10px 10px 8px;
  background: var(--tl-field);
  border-radius: 16px;
}
.tl-pane-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 6px 8px;
}
.tl-pane-head label, .tl-pane-title { font-size: 13px; font-weight: 600; color: var(--color-text-strong); margin: 0; }
.tl-count { font-size: 12px; color: var(--tl-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.tl-input, .tl-output {
  width: 100%;
  min-height: 232px;
  margin: 0;
  padding: 14px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--color-surface);
  box-shadow: inset 0 0 0 1px var(--tl-line);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text-strong);
  transition: box-shadow var(--transition-fast);
}
.tl-input { display: block; resize: vertical; }
.tl-input::placeholder { color: #8A9DA1; }
.tl-input:focus, .tl-output:focus { outline: none; box-shadow: inset 0 0 0 2px var(--tl-ring); }
.tl-output {
  max-height: 560px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  /* Комбинируемые знаки ALA-LC и ISO 9 (дуга, огласовки) — системные
     шрифты рисуют их ровнее, чем гарнитура сайта */
  font-feature-settings: "kern" 1;
}
.tl-output:empty::before { content: attr(data-placeholder); color: #8A9DA1; }

.tl-pane-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 8px 2px 0;
  min-height: 42px;
}
.tl-pane--out .tl-pane-foot { justify-content: flex-end; }
.tl-tool:not(.has-text) .tl-only-text { display: none; }

.tl-ambig {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex: 1 1 220px;
  margin: 0 8px 0 4px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--tl-warn);
}
.tl-ambig i { font-size: 15px; line-height: 1.2; }

/* ---------- Кнопки ---------- */
.tl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  color: var(--color-text-strong);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--transition-fast), box-shadow var(--transition-fast), color var(--transition-fast);
}
.tl-btn i { font-size: 16px; line-height: 1; }
.tl-btn--sm { height: 34px; padding: 0 12px; border-radius: 10px; font-size: 13.5px; }
.tl-btn--quiet { font-weight: 500; color: var(--color-text); }
.tl-btn--quiet:hover { background: var(--color-surface); color: var(--color-text-strong); }
.tl-btn--primary { background: var(--color-accent); color: #06231A; }
.tl-btn--primary:hover:not(:disabled) { background: #17C56C; }
.tl-btn--primary:disabled { background: var(--tl-field-hover); color: var(--tl-muted); cursor: not-allowed; }
.tl-btn--primary.is-done { background: var(--tl-link); color: #fff; }
.tl-btn--line { background: var(--color-surface); box-shadow: inset 0 0 0 1px var(--tl-line-strong); }
.tl-btn--line:hover { box-shadow: inset 0 0 0 1px #B9C1C9; }

.tl-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
}
.tl-icon-btn i { font-size: 16px; line-height: 1; }
.tl-icon-btn:hover { background: var(--color-surface); color: var(--tl-link); }
.tl-icon-btn.is-done { color: var(--tl-link); }
.tl-icon-btn.is-done i::before { content: "\eb7b"; }

/* ---------- Неоднозначные слова ---------- */
.tl-word {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: none;
  font: inherit;
  line-height: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}
.tl-word.is-ambiguous { text-decoration-style: wavy; text-decoration-color: #D08A12; }
.tl-word.is-soft { text-decoration-style: dotted; text-decoration-color: #9DB0B4; }
.tl-word.is-picked { text-decoration-style: solid; text-decoration-color: var(--tl-ring); }
.tl-word:hover { background: var(--tl-field); }

.tl-pop {
  position: absolute;
  z-index: 40;
  min-width: 180px;
  max-width: 280px;
  padding: 6px;
  background: var(--color-surface);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(16, 20, 24, 0.18), 0 0 0 1px var(--tl-line);
}
.tl-pop-title {
  margin: 0;
  padding: 6px 10px 4px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tl-muted);
}
.tl-pop-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font-size: 15px;
  color: var(--color-text-strong);
  cursor: pointer;
}
.tl-pop-item:hover { background: var(--tl-field); }
.tl-pop-item.is-active { background: var(--tl-tint); font-weight: 600; }

/* ---------- Подсказки ---------- */
.tl-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 12px;
  padding: 10px 12px 10px 14px;
  background: var(--tl-tint);
  border-radius: 12px;
}
.tl-note i { font-size: 18px; line-height: 1; color: var(--tl-link); }
.tl-note p { flex: 1 1 240px; margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--color-text-strong); }
.tl-note--warn { background: var(--tl-warn-bg); }
.tl-note--warn i { color: var(--tl-warn); }

/* ---------- Переключатели ---------- */
.tl-opts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.tl-switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 260px;
  margin: 0;
  padding: 11px 14px;
  background: var(--tl-field);
  border-radius: 12px;
  cursor: pointer;
}
.tl-switch input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; }
.tl-switch-track {
  position: relative;
  flex-shrink: 0;
  width: 38px;
  height: 22px;
  border-radius: 11px;
  background: #C3CCD3;
  transition: background-color var(--transition-fast);
}
.tl-switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 20, 24, 0.2);
  transition: transform var(--transition-fast);
}
.tl-switch input:checked + .tl-switch-track { background: var(--color-accent); }
.tl-switch input:checked + .tl-switch-track::after { transform: translateX(16px); }
.tl-switch input:focus-visible + .tl-switch-track { outline: 2px solid var(--tl-ring); outline-offset: 2px; }
.tl-switch-text { display: flex; flex-direction: column; min-width: 0; }
.tl-switch-text strong { font-size: 13.5px; font-weight: 600; color: var(--color-text-strong); }
.tl-switch-text small { font-size: 12px; line-height: 1.4; color: var(--tl-muted); }

/* ---------- Вкладки ---------- */
.tl-extra { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--tl-line); }
.tl-tabs {
  display: flex;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  padding: 3px;
  overflow-x: auto;
  background: var(--tl-field);
  border-radius: 12px;
  scrollbar-width: none;
}
.tl-tabs::-webkit-scrollbar { display: none; }
.tl-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  cursor: pointer;
}
.tl-tab i { font-size: 15px; line-height: 1; }
.tl-tab-short { display: none; }
.tl-tab:hover { color: var(--color-text-strong); }
.tl-tab[aria-selected="true"] {
  background: var(--color-surface);
  font-weight: 600;
  color: var(--color-text-strong);
  box-shadow: 0 1px 2px rgba(16, 20, 24, 0.08), 0 0 0 0.5px rgba(16, 20, 24, 0.06);
}
.tl-panel { margin-top: 12px; }
.tl-empty { margin: 4px 2px 0; font-size: 13px; line-height: 1.6; color: var(--tl-muted); }

/* Все стандарты сразу */
.tl-rows { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.tl-row {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 4px 2px;
  border-radius: 12px;
}
.tl-row:hover { background: var(--tl-field); }
.tl-row.is-current { background: var(--tl-tint); }
.tl-row-pick {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  padding: 5px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.tl-row-name { font-size: 13.5px; font-weight: 600; color: var(--color-text-strong); white-space: nowrap; }
.tl-row-tag { font-size: 12px; color: var(--tl-muted); }
.tl-row-pick:hover .tl-row-name { color: var(--tl-link); }
.tl-row-value {
  display: block;
  min-width: 0;
  padding: 0;
  background: none;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--color-text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Разбор по буквам */
.tl-cells { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tl-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 44px;
  padding: 6px 8px;
  border-radius: 10px;
  background: var(--tl-field);
}
.tl-cell-src { font-size: 13px; color: var(--tl-muted); }
.tl-cell-out { font-size: 15px; font-weight: 600; color: var(--color-text-strong); }
.tl-cell.has-rule { background: var(--tl-tint); box-shadow: inset 0 0 0 1.5px rgba(18, 160, 92, 0.45); }
.tl-cell.is-dropped .tl-cell-out { color: var(--tl-muted); font-weight: 500; }
.tl-legend { margin: 12px 0 0; padding-left: 18px; font-size: 12.5px; line-height: 1.6; color: var(--tl-muted); }

/* Машиночитаемая зона — как на странице паспорта */
.tl-mrz {
  margin: 0 0 8px;
  padding: 14px 16px;
  overflow-x: auto;
  border-radius: 10px;
  background: #F4F1E6;
  box-shadow: inset 0 0 0 1px #E4DECA;
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.08em;
  color: #1E2124;
  white-space: nowrap;
}

.tl-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 16px 0 0;
  font-size: 12.5px;
  color: var(--tl-muted);
}
.tl-foot i { font-size: 14px; color: var(--tl-link); }

/* ---------- Узкий инструмент ---------- */
@container tltool (max-width: 700px) {
  .tl-panes { grid-template-columns: minmax(0, 1fr); }
  .tl-input { min-height: 150px; }
  .tl-output { min-height: 110px; }
  .tl-row { grid-template-columns: minmax(0, 1fr) 34px; row-gap: 0; }
  .tl-row-pick { flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 8px; }
  .tl-row-value { grid-column: 1; grid-row: 2; padding: 0 10px 6px; white-space: normal; overflow-wrap: anywhere; }
  .tl-row-copy { grid-column: 2; grid-row: 1 / span 2; }
  .tl-menu { grid-template-columns: minmax(0, 1fr); width: 100%; }
  .tl-menu-col + .tl-menu-col { padding-left: 0; margin-left: 0; border-left: 0; margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--tl-line); }
}
@container tltool (max-width: 560px) {
  .tl-dir { width: 100%; }
  .tl-lang { flex: 1 1 0; min-width: 0; }
  .tl-std-label { display: none; }
  /* Кнопки стандартов — ровной сеткой в две колонки: все видны сразу
     и не выходят за карточку */
  .tl-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .tl-chip { justify-content: center; min-width: 0; height: auto; min-height: 38px; padding: 6px 8px; white-space: normal; line-height: 1.2; text-align: center; }
  .tl-switch { flex-basis: 100%; }
  .tl-pane-foot { gap: 0; }
  .tl-pane-foot .tl-btn--quiet { padding: 0 8px; gap: 5px; }
  /* Вкладки — сегментами равной ширины с короткими подписями */
  .tl-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; overflow: visible; }
  .tl-tab { justify-content: center; min-width: 0; height: auto; min-height: 36px; padding: 6px 6px; white-space: normal; line-height: 1.2; text-align: center; }
  .tl-tab i { display: none; }
  .tl-tab-full { display: none; }
  .tl-tab-short { display: inline; }
}
@container tltool (max-width: 380px) {
  .tl-pane-foot .tl-btn--quiet i { display: none; }
  .tl-chip { font-size: 13px; }
}
@container tltool (max-width: 280px) {
  .tl-more-full { display: none; }
  .tl-more-short { display: inline; }
}
@media (max-width: 560px) {
  .tl-tool { padding: 16px; border-radius: 20px; }
}

/* =========================================================
   ТЕКСТОВЫЕ РАЗДЕЛЫ
   ========================================================= */
/* Содержание страницы: пронумерованные ссылки-плитки */
.tl-toc {
  margin: 0 0 48px;
  padding: 18px 20px 20px;
  background: var(--color-surface);
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(16, 20, 24, 0.04);
}
.tl-toc-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-strong);
}
.tl-toc-title i { font-size: 16px; line-height: 1; color: var(--tl-link); }
.tl-toc-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tl-toc-list a {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  height: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--tl-field);
  text-decoration: none;
  transition: background-color var(--transition-fast), box-shadow var(--transition-fast);
}
.tl-toc-num {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
  color: var(--tl-link);
}
.tl-toc-text { font-size: 14px; font-weight: 500; line-height: 20px; color: var(--color-text-strong); }
.tl-toc-list a:hover { background: var(--tl-tint); }
.tl-toc-list a:hover .tl-toc-text { color: var(--tl-link); }
.tl-toc-list a:focus-visible { outline: 2px solid var(--tl-ring); outline-offset: 2px; }

/* Отступ под липкую шапку для якорей задаёт style.css ([id]) —
   своё правило здесь его перебило бы на телефоне */
.tl-seo h3 { font-size: 17px; font-weight: 700; color: var(--color-text-strong); margin: 32px 0 10px; }
.tl-seo > p, .tl-seo h3 + p { font-size: 15px; line-height: 1.75; color: var(--color-text); margin: 0 0 14px; }
/* «Код» на этой странице — это примеры записи: латинские имена и знаки (Iuliia, ž, š). Это слова,
   а не программный текст, поэтому плашка оформлена по общему стандарту сайта (серая, 500,
   тот же радиус и отступы), но набрана шрифтом текста, а не моноширинным. В таблицах — без
   плашки, как и везде. */
.tl-seo code {
  font-family: var(--font-body);
  font-size: 0.95em;
  /* Длинные примеры переносятся по пробелам, а плашка не рвётся на
     строках — иначе на телефоне пример вылезает за раздел */
  white-space: normal;
  overflow-wrap: break-word;
}
.tl-seo .tl-table code { white-space: nowrap; }

/* Специфичнее, чем .tl-seo > p: пояснение после таблиц и карточек
   должно отстоять от них, а не прилипать */
.tl-seo .tl-muted { font-size: 13.5px; line-height: 1.7; color: var(--tl-muted); margin: 16px 0 0; }

.tl-list { margin: 0 0 16px; padding-left: 20px; }
.tl-list li { margin: 0 0 8px; font-size: 15px; line-height: 1.7; color: var(--color-text); }
.tl-list strong { color: var(--color-text-strong); }

/* Перевод / транскрипция / транслитерация */
.tl-compare { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 4px 0 18px; }
.tl-compare-item { padding: 16px 18px; background: var(--color-surface); border-radius: 16px; }
.tl-compare-item.is-accent { box-shadow: inset 0 0 0 2px var(--color-accent); }
.tl-compare-item p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--color-text); }
.tl-compare-name { font-weight: 700; color: var(--color-text-strong) !important; margin-bottom: 2px !important; }
.tl-compare-example { margin-top: 10px !important; color: var(--color-text-strong) !important; }

.tl-callout {
  display: flex;
  gap: 12px;
  margin: 22px 0 0;
  padding: 16px 18px;
  background: var(--tl-tint);
  border-radius: 16px;
}
.tl-callout i { font-size: 20px; line-height: 1.35; color: var(--tl-link); }
.tl-callout p { margin: 0; font-size: 14.5px; line-height: 1.7; color: var(--color-text); }
.tl-callout strong { color: var(--color-text-strong); }

/* Таблицы */
.tl-table-wrap {
  overflow-x: auto;
  background: var(--color-surface);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(16, 20, 24, 0.04);
}
.tl-table-wrap:focus-visible { outline: 2px solid var(--tl-ring); outline-offset: 2px; }
.tl-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.tl-table th, .tl-table td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--tl-line); }
.tl-table tbody tr:last-child > * { border-bottom: 0; }
.tl-table thead th {
  background: var(--color-text-strong);
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  vertical-align: bottom;
}
.tl-table thead th small { display: block; font-size: 11px; font-weight: 400; opacity: 0.72; }
.tl-table tbody th { font-weight: 600; color: var(--color-text-strong); white-space: nowrap; }
.tl-table td { color: var(--color-text); line-height: 1.55; }
.tl-table sup { font-size: 10px; color: var(--tl-link); font-weight: 700; margin-left: 2px; }
.tl-none { color: var(--tl-muted); }

.tl-table--choice td:first-child { width: 38%; color: var(--color-text-strong); }
.tl-table--choice td:nth-child(2) { width: 20%; white-space: nowrap; }
.tl-table--choice td:last-child { color: var(--tl-muted); }

.tl-table--letters { min-width: 1240px; }
.tl-table--letters th, .tl-table--letters td { padding: 8px 10px; }
.tl-table--letters tbody tr:nth-child(even) > * { background: #FAFBFC; }
.tl-table--letters th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 64px;
  background: var(--color-surface);
  box-shadow: 1px 0 0 var(--tl-line);
}
.tl-table--letters thead th:first-child { background: var(--color-text-strong); }
.tl-table--names { min-width: 760px; }
/* Специфичнее, чем .tl-seo > p, — иначе подпись прилипает к таблице */
.tl-seo .tl-table-hint {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 10px 4px 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--tl-muted);
}
/* Иконка — по первой строке, когда подпись переносится на телефоне */
.tl-table-hint i { flex-shrink: 0; font-size: 14px; line-height: 19px; color: var(--tl-link); }

.tl-footnotes { margin: 18px 0 0; padding-left: 20px; }
.tl-footnotes li { margin: 0 0 6px; font-size: 13.5px; line-height: 1.7; color: var(--color-text); }

/* Буквы паспорта */
.tl-letters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 18px 0 8px; }
.tl-letter-card { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--color-surface); border-radius: 14px; }
/* Буквы — основной гарнитурой: у Soyuz Grotesk своеобразные формы
   Й, Ц, Щ, а здесь буква должна читаться однозначно */
.tl-letter-cyr { font-family: var(--font-body); font-size: 28px; font-weight: 700; line-height: 1.1; color: var(--color-text-strong); }
.tl-letter-card code { align-self: flex-start; max-width: none; line-height: inherit; margin: 4px 0 2px; font-size: 15px !important; font-weight: 700 !important; color: var(--tl-link) !important; background: none !important; padding: 0 !important; }
.tl-letter-card span:last-child { font-size: 12.5px; color: var(--tl-muted); }

/* История правил */
.tl-timeline { margin: 12px 0 16px; padding: 0 0 0 4px; list-style: none; }
.tl-timeline li { position: relative; padding: 0 0 18px 24px; border-left: 2px solid var(--tl-line); }
.tl-timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl-timeline li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-bg);
}
.tl-timeline p { margin: 0; font-size: 14.5px; line-height: 1.7; color: var(--color-text); }
.tl-timeline .tl-timeline-when { margin-bottom: 2px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--tl-link); }

/* Карточки сценариев */
.tl-cases { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.tl-case { padding: 20px 22px; background: var(--color-surface); border-radius: 20px; }
.tl-case-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.tl-case-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--tl-tint);
  color: var(--tl-link);
  font-size: 18px;
}
.tl-case h3 { margin: 0 !important; font-size: 16px !important; line-height: 1.35; }
.tl-case p { margin: 0; font-size: 14.5px; line-height: 1.7; color: var(--color-text); }

/* Трудные буквы */
.tl-dl { display: grid; gap: 8px; margin: 0; }
.tl-dl > div { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 16px; padding: 14px 18px; background: var(--color-surface); border-radius: 14px; }
.tl-dl dt { font-family: var(--font-body); font-size: 18px; font-weight: 700; color: var(--color-text-strong); }
.tl-dl dd { margin: 0; font-size: 14.5px; line-height: 1.75; color: var(--color-text); }

/* Источники */
.tl-sources { margin: 0; padding: 0; list-style: none; background: var(--color-surface); border-radius: 16px; }
.tl-sources li { padding: 12px 18px; border-bottom: 1px solid var(--tl-line); font-size: 14px; line-height: 1.6; color: var(--color-text); }
.tl-sources li:last-child { border-bottom: 0; }
.tl-method { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 16px 0 0; }
.tl-method-item { padding: 16px 18px; background: var(--color-surface); border-radius: 16px; }
.tl-method-item strong { display: block; font-family: var(--font-display); font-size: 28px; line-height: 1.1; color: var(--tl-link); }
.tl-method-item span { display: block; margin-top: 6px; font-size: 13.5px; line-height: 1.55; color: var(--color-text); }

@media (max-width: 900px) {
  .tl-compare, .tl-cases, .tl-method { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .tl-dl > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .tl-table--choice td:nth-child(2) { white-space: normal; }
  .tl-toc { margin-bottom: 36px; padding: 16px; }
  .tl-toc-list { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
  .tl-toc-list a { padding: 9px 10px; gap: 8px; }
  .tl-toc-text { font-size: 13.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .tl-swap i, .tl-switch-track, .tl-switch-track::after, .tl-chip--more i { transition: none; }
}
