/* карманный-гений.рф — справочник по ИИ для жизни */
/* Самохостинг: cyrillic + latin, веса диапазоном (гарнитуры переменные). */
@font-face{font-family:'Golos Text';font-style:normal;font-weight:400 600;font-display:swap;src:url(../fonts/golos-text-cyrillic.woff2) format('woff2');unicode-range:U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;}
@font-face{font-family:'Golos Text';font-style:normal;font-weight:400 600;font-display:swap;src:url(../fonts/golos-text-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:400 500;font-display:swap;src:url(../fonts/jetbrains-mono-cyrillic.woff2) format('woff2');unicode-range:U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:400 500;font-display:swap;src:url(../fonts/jetbrains-mono-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:'Unbounded';font-style:normal;font-weight:500 700;font-display:swap;src:url(../fonts/unbounded-cyrillic.woff2) format('woff2');unicode-range:U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;}
@font-face{font-family:'Unbounded';font-style:normal;font-weight:500 700;font-display:swap;src:url(../fonts/unbounded-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}


:root {
  --ink: #16224b;
  /* вторичный текст обязан держать ≥ 7:1 на бумаге (SPEC); было #4a5783 — 6:1 */
  --ink-soft: #3f4b74;
  --paper: #f2f4f9;
  --card: #ffffff;
  --rule: #c9d2e6;
  --stamp: #c9302b;
  --hl: #ffe9a8;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --display: "Unbounded", "Golos Text", sans-serif;
  --body: "Golos Text", system-ui, sans-serif;
  --max: 72rem;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0 2.05em,
      var(--rule) 2.05em calc(2.05em + 1px)
    );
  background-color: var(--paper);
  background-position: 0 6.4rem;
}

/* зерно бумаги — поверх всего, под навигацией */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
}

/* красная поля тетради */
@media (min-width: 56rem) {
  body::before {
    content: "";
    position: fixed;
    top: 0;
    bottom: 0;
    left: 2.6rem;
    width: 1px;
    background: rgba(201, 48, 43, 0.35);
    z-index: 1;
    pointer-events: none;
  }
}

::selection { background: var(--hl); color: var(--ink); }

a { color: var(--ink); text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--stamp); }

:focus-visible {
  outline: 2px solid var(--stamp);
  outline-offset: 2px;
  border-radius: 2px;
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  overflow-wrap: break-word;
  margin: 0 0 0.6em;
}
h1 { font-size: clamp(1.75rem, 6.5vw, 4.1rem); font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: 1.15rem; }

.eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--stamp);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  margin: 0 0 1.1rem;
  box-shadow: 0 1px 2px rgba(22, 34, 75, 0.05);
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }

/* ——— доступность ——— */
/* якорь садится ниже липкой шапки: её высоту меряет скрипт, запас — на случай без него */
[id] { scroll-margin-top: calc(var(--head-h, 6rem) + 0.75rem); }
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 30;
  background: var(--ink);
  color: var(--card);
  padding: 0.6rem 1.2rem;
  border-radius: 0 0 8px 0;
  text-decoration: none;
}
.skip:focus { left: 0.9rem; }
button, a { touch-action: manipulation; }
:root { -webkit-tap-highlight-color: rgba(22, 34, 75, 0.12); }
h1, h2 { text-wrap: balance; }
.lead, .thesis { text-wrap: pretty; }
.meta, .howmany, .toc .num, .section-head .note { font-variant-numeric: tabular-nums; }

/* ——— шапка: парящая пилюля ——— */
.masthead {
  position: sticky;
  top: 0.9rem;
  z-index: 20;
  pointer-events: none;
}
.masthead .wrap {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  width: fit-content;
  max-width: calc(100vw - 2rem);
  margin: 0 auto;
  padding: 0.65rem 1.4rem;
  background: rgba(242, 244, 249, 0.86);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--rule);
  border-radius: 999px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 2px 4px rgba(22, 34, 75, 0.05),
    0 18px 40px -18px rgba(22, 34, 75, 0.25);
  transition: box-shadow 0.5s var(--ease);
}
.logo {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.02rem;
  text-decoration: none;
  white-space: nowrap;
}
.logo .dot { color: var(--stamp); }
.masthead nav { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.masthead nav a {
  font-size: 0.92rem;
  text-decoration: none;
  color: var(--ink-soft);
}
.masthead nav a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--stamp); }

/* ——— подвал ——— */
.colophon {
  margin-top: 5rem;
  border-top: 2px solid var(--ink);
  background: var(--paper);
}
.colophon .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
  padding-top: 2rem;
  padding-bottom: 2rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.colophon .fine { max-width: 34rem; }

/* ——— обложка / hero ——— */
.cover { padding: 4.5rem 0 3.5rem; }
.cover .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}
.cover .wrap > * { min-width: 0; }
.cover .thesis { font-size: 1.18rem; color: var(--ink-soft); max-width: 34rem; }
.cover .thesis strong { color: var(--ink); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  margin-top: 1.8rem;
  padding: 0.55rem 0.55rem 0.55rem 1.6rem;
  font-family: var(--display);
  font-size: 0.92rem;
  font-weight: 600;
  background: var(--ink);
  color: var(--card);
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid var(--ink);
  box-shadow: 0 10px 24px -10px rgba(22, 34, 75, 0.55);
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease), background 0.5s var(--ease);
}
.btn .btn-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.5s var(--ease), background 0.5s var(--ease);
}
.btn:hover {
  background: var(--stamp);
  border-color: var(--stamp);
  transform: translateY(-2px);
  box-shadow: 0 16px 32px -10px rgba(201, 48, 43, 0.5);
}
.btn:hover .btn-ico { transform: translate(2px, -2px) scale(1.06); background: rgba(255, 255, 255, 0.24); }
.btn:active { transform: scale(0.98) translateY(0); }

/* ——— фирменная карточка задач: «двойная рамка» ——— */
.taskcard {
  background:
    linear-gradient(var(--card), var(--card)) padding-box,
    var(--card);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--stamp);
  border-radius: 14px;
  padding: 1.5rem 1.6rem 1.7rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 0 0 5px rgba(22, 34, 75, 0.035),
    0 2px 4px rgba(22, 34, 75, 0.05),
    0 24px 48px -20px rgba(22, 34, 75, 0.28);
}
.taskcard h2 { font-size: 1.02rem; font-family: var(--display); margin-bottom: 1rem; }
.taskcard .chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.2rem; }
.chip {
  font-family: var(--body);
  font-size: 0.86rem;
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.42rem 0.95rem;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease),
              background 0.4s var(--ease), color 0.4s var(--ease),
              box-shadow 0.4s var(--ease);
}
.chip:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -8px rgba(22, 34, 75, 0.4);
}
.chip:active { transform: scale(0.97); }
.chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--card);
  border-color: var(--ink);
}
.taskcard .prompt {
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--hl);
  padding: 1rem 1.15rem;
  border-radius: 8px;
  box-shadow: inset 0 1px 3px rgba(22, 34, 75, 0.08);
  margin: 0;
  min-height: 7.5em;
  transition: transform 0.5s var(--ease), opacity 0.5s var(--ease);
}
.prompt-swapping { transform: translateY(6px); opacity: 0; }

/* ——— оглавление ——— */
section { padding: 4.5rem 0; }
.section-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.4rem 1rem; margin-bottom: 1.6rem; }
.section-head h2 { margin: 0; }
.section-head .note { font-family: var(--mono); font-size: 0.76rem; color: var(--ink-soft); }

.toc { list-style: none; margin: 0; padding: 0; }
.toc li { margin-bottom: 0.35rem; }
.toc a {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  text-decoration: none;
  padding: 0.5rem 0.7rem;
  margin: 0 -0.7rem;
  border-radius: 8px;
  transition: background 0.4s var(--ease), transform 0.4s var(--ease);
}
.toc a:hover { background: rgba(255, 255, 255, 0.75); transform: translateX(3px); }
.toc a:hover .dots { border-bottom-color: rgba(201, 48, 43, 0.5); }
.toc a:hover .t { text-decoration: underline; text-decoration-color: var(--stamp); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.toc .num {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--stamp);
  flex: none;
}
.toc .t { font-weight: 600; font-size: 1.05rem; flex: none; max-width: 70%; overflow-wrap: break-word; }
.toc .dots {
  flex: 1;
  border-bottom: 2px dotted var(--rule);
  transform: translateY(-0.25em);
  min-width: 2rem;
}
.toc .howmany { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-soft); flex: none; }

/* ——— как пользоваться ——— */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; counter-reset: step; }
.steps article {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 1.6rem 1.7rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 0 0 4px rgba(22, 34, 75, 0.03),
    0 18px 36px -18px rgba(22, 34, 75, 0.2);
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
}
.steps article:hover {
  transform: translateY(-3px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 0 0 4px rgba(22, 34, 75, 0.03),
    0 26px 46px -18px rgba(22, 34, 75, 0.28);
}
.steps article::before {
  counter-increment: step;
  content: "шаг " counter(step);
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stamp);
  margin-bottom: 0.6rem;
}
.steps h3 { font-size: 1rem; }
.steps p { margin: 0; font-size: 0.94rem; color: var(--ink-soft); }

/* ——— страница раздела ——— */
.page-head { padding: 3.5rem 0 1.5rem; }
.breadcrumb { font-family: var(--mono); font-size: 0.76rem; color: var(--ink-soft); margin-bottom: 1rem; }
.breadcrumb a { color: var(--ink-soft); }
.lead { font-size: 1.12rem; color: var(--ink-soft); max-width: 40rem; }
.coming-soon {
  border: 1px dashed var(--rule);
  border-radius: 4px;
  padding: 1.2rem 1.4rem;
  color: var(--ink-soft);
  font-size: 0.94rem;
  background: var(--card);
}

/* ——— статья ——— */
.article { max-width: 44rem; }
.article .meta { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-soft); margin-bottom: 2.2rem; }
.article h2 { margin-top: 2.4em; }
.article p { margin: 0 0 1.2em; }
.article ul, .article ol { padding-left: 1.3em; margin: 0 0 1.3em; }
.article li { margin-bottom: 0.4em; }
.article mark { background: var(--hl); padding: 0 0.15em; }
/* таблица в статье: на узком экране прокручивается внутри рамки, а не рвёт страницу */
.article .table-wrap { overflow-x: auto; margin: 0 0 1.3em; }
.article table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.article .table-wrap table { min-width: 34rem; margin: 0; }
.article caption {
  caption-side: top;
  text-align: left;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stamp);
  padding: 0 0 0.6rem;
}
.article th, .article td {
  text-align: left;
  vertical-align: top;
  padding: 0.55em 0.7em;
  border-bottom: 1px solid var(--rule);
}
.article th { font-weight: 600; background: var(--paper); border-top: 1px solid var(--rule); }

.recept {
  position: relative;
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--stamp);
  border-radius: 10px;
  padding: 1.3rem 1.4rem;
  margin: 1.8rem 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 14px 30px -18px rgba(22, 34, 75, 0.25);
}
.recept figcaption {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stamp);
  margin-bottom: 0.6rem;
  padding-right: 7.5rem; /* место под кнопку копирования в правом верху */
}
.recept pre {
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0 0 0.4rem;
}
.copy {
  position: absolute;
  top: 0.55rem;
  right: 0.7rem;
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font-family: var(--body);
  font-size: 0.76rem;
  padding: 0.3rem 0.8rem;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease),
              box-shadow 0.4s var(--ease);
}
.copy:hover { border-color: var(--ink); transform: translateY(-1px); box-shadow: 0 4px 10px -6px rgba(22, 34, 75, 0.5); }
.copy:active { transform: scale(0.96); }

.warn {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1rem 1.2rem;
  font-size: 0.94rem;
  margin: 1.6rem 0;
}
.warn b { color: var(--stamp); }

.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
  font-size: 0.92rem;
}

/* заголовок ссылки длиннее строки — ссылка должна сжиматься и переноситься;
   отступ по вертикали даёт цели под палец не меньше 44 пикселей */
.pager a { min-width: 0; padding: 0.75rem 0; }

/* буквица в начале статьи */
.article .lead::first-letter {
  font-family: var(--display);
  font-weight: 700;
  font-size: 3.1em;
  line-height: 0.9;
  float: left;
  padding: 0.04em 0.14em 0 0;
  color: var(--ink);
}

/* прогресс чтения */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 25;
  pointer-events: none;
  background: var(--stamp);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* ——— появление при прокрутке ——— */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.reveal.shown { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ——— указатель рецептов: картотека в той же бумаге ——— */
.ukaz-head { padding-top: 1.5rem; }
.ukaz-itog { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-soft); margin: 0 0 1.1rem; }
.ukaz-itog b { color: var(--ink); font-variant-numeric: tabular-nums; }
.ukaz-words {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
  padding-left: 2.2rem;
  margin: -0.15rem 0 0.55rem;
}
.vybor { margin-top: 1.3rem; }

.finder {
  background: var(--card);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--stamp);
  border-radius: 14px;
  padding: 1.3rem 1.4rem 1.4rem;
  margin-top: 1.8rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 0 0 5px rgba(22, 34, 75, 0.035),
    0 18px 36px -20px rgba(22, 34, 75, 0.25);
}
.facet + .facet { margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px dashed var(--rule); }
.facet-name {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.7rem;
}
.facet-name::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  background: var(--stamp);
  transform: rotate(45deg);
  flex: none;
}
#facet-d-wrap .facet-name::before { background: var(--ink); }
#facet-s-wrap .facet-name::before { background: var(--hl); box-shadow: inset 0 0 0 1px var(--ink-soft); }
.finder .chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chip-n {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
  margin-left: 0.45rem;
}
.chip[disabled] { opacity: 0.4; cursor: default; }
.chip[disabled]:hover { transform: none; border-color: var(--rule); box-shadow: none; }
.chips.words .chip { font-size: 0.82rem; min-height: 2.3rem; padding: 0.3rem 0.75rem; }
.chips.tiny .chip { font-size: 0.78rem; min-height: 2.3rem; padding: 0.3rem 0.8rem; }
#chips-d .chip[aria-pressed="true"] { background: var(--stamp); border-color: var(--stamp); color: var(--card); }
#chips-s .chip[aria-pressed="true"] {
  background: var(--hl);
  border-color: var(--ink);
  color: var(--ink);
  box-shadow: inset 0 -2px 0 rgba(201, 48, 43, 0.45);
}

.finder-bar {
  position: sticky;
  top: var(--bar-top, 4.6rem);
  z-index: 15;
  display: grid;
  /* полоса кнопок не имеет своей ширины: без нулевого минимума колонка сетки
     растёт по содержимому и уводит страницу вбок */
  grid-template-columns: minmax(0, 1fr);
  gap: 0.6rem;
  margin: 1.2rem 0 0;
  padding: 0.75rem 0.95rem;
  background: rgba(242, 244, 249, 0.93);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: 0 12px 26px -18px rgba(22, 34, 75, 0.45);
}
.found { margin: 0; font-family: var(--mono); font-size: 0.8rem; color: var(--ink-soft); }
.found b { color: var(--ink); font-variant-numeric: tabular-nums; }
.bar-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem 0.9rem; }
.basket {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.9rem;
  min-width: 0;
  border-top: 1px dashed var(--rule);
  padding-top: 0.6rem;
}
.basket-count { margin: 0; font-family: var(--mono); font-size: 0.78rem; color: var(--ink-soft); }
.basket-count b { color: var(--ink); font-variant-numeric: tabular-nums; }
.basket-full .basket-count b { color: var(--stamp); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr));
  gap: 1.1rem;
  margin-top: 1.4rem;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--stamp);
  border-radius: 10px;
  padding: 1.05rem 1.15rem 1.1rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 14px 28px -20px rgba(22, 34, 75, 0.3);
  animation: card-in 0.45s var(--ease) both;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 22px 38px -20px rgba(22, 34, 75, 0.35);
}
.card[data-picked="1"] { border-left-color: var(--ink); box-shadow: 0 0 0 2px var(--hl), 0 14px 28px -20px rgba(22, 34, 75, 0.3); }
@keyframes card-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; }
.card-src { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-soft); min-width: 0; }
.card-src a { color: var(--ink-soft); text-decoration-style: dotted; }
.card-src a:hover { color: var(--ink); text-decoration-color: var(--stamp); }
.card-num {
  flex: none;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  color: var(--stamp);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}
.card h3 { font-size: 0.98rem; margin: 0; }
.card-step { font-family: var(--mono); font-size: 0.71rem; color: var(--ink-soft); margin: 0; }
.card-text {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--paper);
  border-radius: 8px;
  padding: 0.8rem 0.9rem;
  margin: 0;
  box-shadow: inset 0 1px 3px rgba(22, 34, 75, 0.07);
}
.card-text mark { background: var(--hl); padding: 0 0.12em; border-radius: 2px; }
.card-tools { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: auto; padding-top: 0.2rem; }
.card-tools .chip { font-size: 0.78rem; min-height: 2.4rem; padding: 0.35rem 0.85rem; }

.empty {
  border: 1px dashed var(--rule);
  border-radius: 8px;
  background: var(--card);
  padding: 1.2rem 1.4rem;
  color: var(--ink-soft);
  font-size: 0.94rem;
  margin: 1.4rem 0 0;
}
.load-note {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--ink-soft);
  border-left: 2px solid var(--rule);
  padding-left: 0.85rem;
  margin: 1.3rem 0 0;
}
.linkbtn {
  background: none;
  border: 0;
  padding: 0.5rem 0;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--stamp);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.linkbtn:hover { color: var(--ink); }
.more-wrap { text-align: center; margin: 1.6rem 0 0; }
.btn-line {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.6rem 1.5rem;
  font-family: var(--display);
  font-size: 0.86rem;
  font-weight: 600;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 10px 22px -14px rgba(22, 34, 75, 0.5);
  transition: transform 0.4s var(--ease), background 0.4s var(--ease), color 0.4s var(--ease);
}
.btn-line:hover { background: var(--ink); color: var(--card); transform: translateY(-1px); }
.btn-line:active { transform: scale(0.98); }

/* полоса прокрутки — в своей бумаге, а не системная */
html { scrollbar-color: var(--rule) var(--paper); scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: var(--rule); border: 2px solid var(--paper); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-soft); }

/* ——— адаптив ——— */
@media (max-width: 56rem) {
  body { background-image: none; }
  .cover { padding-top: 2.5rem; }
  .cover .wrap { grid-template-columns: 1fr; gap: 2rem; }
  .steps { grid-template-columns: 1fr; }
  .toc .t { max-width: 100%; flex: 1 1 auto; min-width: 0; }
  .toc .dots, .toc .howmany { display: none; }
  /* палец: цели не мельче 44 пикселей, кнопка копирования — своей строкой */
  .chip { font-size: 0.9rem; padding: 0.8rem 1.05rem; }
  .copy {
    position: static;
    justify-content: center;
    width: 100%;
    min-height: 2.75rem;
    margin-top: 0.6rem;
  }
  .recept figcaption { padding-right: 0; }
  /* указатель: цели под палец, счётчик рецептов остаётся виден и на узком экране */
  .ukaz a { flex-wrap: wrap; }
  .ukaz .howmany { display: inline; }
  .ukaz-words { padding-left: 0; }
  .chips.words .chip, .chips.tiny .chip, .card-tools .chip {
    font-size: 0.86rem;
    min-height: 2.75rem;
    padding: 0.6rem 0.9rem;
  }
  .finder { padding: 1.1rem 1rem 1.2rem; }
  /* шесть рядов кнопок съедают половину экрана телефона: ряды едут полосой,
     а кнопки набора ждут первого рецепта — счётчик набора виден всегда */
  .finder-bar { top: var(--bar-top, 5.8rem); gap: 0.5rem; padding: 0.6rem 0.7rem; }
  .bar-tools, .basket .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding-bottom: 0.3rem;
    scrollbar-color: var(--rule) transparent;
    scrollbar-width: thin;
  }
  .bar-tools > .chips, .bar-tools > .chip, .basket .chips > .chip { flex: 0 0 auto; }
  .bar-tools > .chips { flex-wrap: nowrap; }
  .bar-tools::-webkit-scrollbar, .basket .chips::-webkit-scrollbar { height: 4px; }
  .bar-tools::-webkit-scrollbar-track, .basket .chips::-webkit-scrollbar-track { background: transparent; }
  .bar-tools::-webkit-scrollbar-thumb, .basket .chips::-webkit-scrollbar-thumb { background: var(--rule); border: 0; }
  .basket { flex-wrap: wrap; gap: 0.5rem 0.6rem; padding-top: 0.5rem; }
  .basket-count { flex: 0 0 auto; }
  .basket .chips { display: none; }
  /* кнопки набора — своей строкой: рядом со счётчиком длинная не влезает целиком */
  .basket-full .chips { display: flex; flex: 1 1 100%; min-width: 0; }
  .cards { grid-template-columns: 1fr; }
  .linkbtn { min-height: 2.75rem; }
}

/* ——— телефон: четвёртый пункт шапки уводит пилюлю в три строки ——— */
@media (max-width: 35rem) {
  .masthead nav { gap: 0.5rem; }
  .masthead nav a { font-size: 0.86rem; }
  /* без скрипта пилюля в три строки: запас отступа берём по ней, а не по обычной высоте */
  [id] { scroll-margin-top: calc(var(--head-h, 11rem) + 0.75rem); }
}
