/* СТОкарта — помощник. Telegram Mini App.
   Главный экран — перенос утвержденного mockups/home-final.css без изменений.
   Окна (формы, «Вопросы и ответы», «Спасибо») — по макету Марины
   mockups/reference/marina-form-mockup.png (iPhone 390 pt, 1170 px ÷ 3),
   с правками t130u (без «Написать в Telegram», мельче плашка) и t131u (отступы у кнопки). */

@font-face {
  font-family: Roboto;
  src: url("assets/fonts/roboto-light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-stretch: 100%;
  font-display: swap;
}

@font-face {
  font-family: Roboto;
  src: url("assets/fonts/roboto-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-stretch: 100%;
  font-display: swap;
}

@font-face {
  font-family: Roboto;
  src: url("assets/fonts/roboto-medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-stretch: 100%;
  font-display: swap;
}

@font-face {
  font-family: Roboto;
  src: url("assets/fonts/roboto-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: RobotoCondensed;
  src: url("assets/fonts/roboto-condensed-semibold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: RobotoCondensed;
  src: url("assets/fonts/roboto-condensed-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ===== Главный экран (home-final) ===== */
:root {
  --yellow: #ffd600;
  --black: #0c0c0c;
  --card: #fff;
  --ink: #111;
  --lead: var(--yellow);
  --gap: 12px;
  --side: 12px;
  --tile-min: 120px;
}

/* Реальная отправка, политика и скрытая ловушка. */
.form-trap { display: none !important; }
.form-alert { margin: 12px 0; padding: 10px 12px; border: 1px solid #d32f4d; border-radius: 10px; color: #7b1730; background: #fff0f5; font-size: 14px; line-height: 1.4; }
.form-alert[hidden] { display: none; }
.captcha-slot { width: 100%; margin: 12px 0; min-width: 0; }
.captcha-slot:empty { display: none; }
.site-foot a { color: inherit; text-underline-offset: 3px; }
.site-foot span { text-align: center; }
.policy-body { overflow-wrap: anywhere; }
.policy-body .shell { max-width: none; padding: 0; }
.policy-body p, .policy-body li { font-size: 16px; line-height: 1.4; }
.policy-body h2 { margin: 24px 0 12px; font-size: 20px; line-height: 1; }
.policy-body ul { padding-left: 22px; }
.policy-body a { color: #0077ff; }
.policy-body .submit { width: 100%; margin-top: 20px; }
.receipt-number { display: inline-block; margin: 8px 0; overflow-wrap: anywhere; }

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background: var(--black);
  color: #fff;
  font-family: Roboto, Arial, sans-serif;
  font-style: normal;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--black);
  border-top: 3px solid var(--yellow);
}

.hero {
  position: relative;
  flex: 0 0 auto;
  --title-row: calc(16px + 32px);
  padding: 16px 8px 12px 16px;
  min-height: 156px;
}

.hero-text {
  position: relative;
  z-index: 1;
}

.hero h1 {
  display: flex;
  align-items: center;
  gap: 0.28em;
  margin: 0;
  width: max-content;
  max-width: 100%;
  color: #fff;
  font-family: Roboto, Arial, sans-serif;
  font-weight: 300;
  font-style: normal;
  font-stretch: 100%;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.logo {
  display: block;
  height: 32px;
  width: auto;
  flex: none;
}

.h1-text {
  font-weight: 300;
  font-style: normal;
  font-stretch: 100%;
}

.lead {
  display: block;
  margin: 8px 0 0;
  width: max-content;
  max-width: 100%;
  color: var(--lead);
  font-family: Roboto, Arial, sans-serif;
  font-weight: 400;
  font-style: normal;
  font-stretch: 100%;
  font-size: 15px;
  line-height: 1.22; /* t141u */
}

/* t140u: две строки — «Заявки и ответы» / «по каталогу stokarta.ru», вторая строка не переносится */
.lead-line {
  display: block;
  white-space: nowrap;
}

.catalog-link {
  color: #fff;
  font-family: Roboto, Arial, sans-serif;
  font-weight: 400;
  font-style: normal;
  font-stretch: 100%;
  font-size: inherit;
  line-height: inherit;
  white-space: nowrap;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.catalog-link:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

.art {
  position: absolute;
  right: 0;
  top: var(--title-row);
  bottom: 0;
  width: auto;
  max-width: 58%;
  max-height: 100%;
  height: auto;
  object-fit: contain;
  object-position: right bottom;
  pointer-events: none;
}

main {
  flex: 1 1 0;
  display: flex;
  padding: 4px var(--side) 12px;
  min-height: calc(4 * var(--tile-min) + 3 * var(--gap) + 16px);
}

.tiles {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  width: 100%;
  min-height: calc(4 * var(--tile-min) + 3 * var(--gap));
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(4, minmax(var(--tile-min), 1fr));
  gap: var(--gap);
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0 8px;
  background: var(--card);
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
}

.tile:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

.tile img {
  display: block;
  flex: none;
  width: auto;
  height: 50%;
  max-width: 74%;
  object-fit: contain;
}

.tile-label {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  flex: none;
  margin-top: 6px;
  width: 100%;
  min-height: 2.5em;
  max-height: 2.5em;
  overflow: hidden;
  text-align: center;
  font-family: Roboto, Arial, sans-serif;
  font-size: 13px;
  font-weight: 500;
  font-style: normal;
  font-stretch: 100%;
  line-height: 1.25;
  letter-spacing: 0;
}

/* Название и адрес «Перейти на сайт»: обертка занимает ровно место названия (как в других плитках),
   адрес висит абсолютно сразу под первой строкой названия и не сдвигает иконку и название (t135u, t136u) */
.tile-text {
  position: relative;
  display: block;
  flex: none;
  width: 100%;
}

.tile-url {
  position: absolute;
  left: 0;
  right: 0;
  /* 6px отступ названия + одна строка названия (13px × 1,25) + зазор 3px */
  top: calc(6px + 13px * 1.25 + 3px);
  display: block;
  margin: 0;
  text-align: center;
  font-family: Roboto, Arial, sans-serif;
  font-size: 11px;
  font-weight: 400;
  font-style: normal;
  font-stretch: 100%;
  line-height: 1.2;
  color: #4a4a4a;
}

@media (max-width: 340px) {
  .hero {
    --title-row: calc(12px + 26px);
    padding: 12px 6px 10px 12px;
    min-height: 132px;
  }

  .logo { height: 26px; }

  .hero h1 { font-size: 16px; }

  .lead { font-size: 13px; }

  .tile-label { font-size: 11px; }
  .tile-url { font-size: 10px; top: calc(6px + 11px * 1.25 + 3px); }
}

/* ===== Главный экран целиком в окне (t142u, t143u) =====
   Высота страницы = видимая область Telegram (--tg-viewport-stable-height, ее ставит telegram-web-app.js),
   вне Telegram — 100dvh. Шапка (2 строки подзаголовка) — плитки 2×4 — футер.
   Плитки делят всю оставшуюся высоту поровну и доходят до футера; от нижнего ряда до футера — тот же зазор,
   что между плитками. Иконка уменьшается/растет по месту, подписи 13px (11px на 320) не трогаем. */
:root {
  --app-h: var(--tg-viewport-stable-height, 100dvh);
  /* высота шапки = ряд заголовка + картинка с машинами (58% ширины × 0,399), картинка не уменьшается */
  --hero-h: min(156px, calc(49px + 23.2vw));
  --foot-h: 28px;
}

@media (max-width: 340px) {
  :root { --hero-h: calc(39px + 23.2vw); }
}

.page {
  height: var(--app-h);
  min-height: 0;
}

.hero { min-height: var(--hero-h); }

main {
  flex: 1 1 0;
  min-height: 0;
  padding: 4px var(--side) var(--gap);
}

.tiles {
  min-height: 0;
  grid-template-rows: repeat(4, minmax(0, 1fr));
}

/* иконка: половина плитки, но всегда оставляет место под 2 строки названия; не больше 112px */
.tile img {
  height: min(50%, calc(100% - 46px), 112px);
  min-height: 18px;
}

@media (max-width: 340px) {
  .tile img { height: min(50%, calc(100% - 41px), 112px); }
}

/* невысокие окна: зазоры и поля поменьше */
@media (max-height: 640px) {
  :root { --gap: 8px; }
  main { padding-top: 2px; }
}

/* ===== Футер (t143u, t146u): только «© СТОкарта, год», по центру ===== */
.site-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--foot-h);
  padding: 0 var(--side) env(safe-area-inset-bottom);
  color: #a3a3a3;          /* 7,9:1 на #080808 */
  font-family: Roboto, Arial, sans-serif;
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
}

/* Планшет: главный экран не растягивается на всю ширину */
@media (min-width: 600px) {
  .page { max-width: 480px; margin: 0 auto; }
}

/* ===== Общее ===== */
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

html.has-modal,
html.has-modal body { overflow: hidden; }

/* ===== Окно ===== */
:root {
  --m-bg: #080808;
  --m-head: #151515;
  --m-edge: #323232;
  --m-ink: #191919;
  --m-text: #343434;
  --m-muted: #5c5c5c;
  --m-ph: #555;
  --m-plate: #f5f5f3;
  --m-field-line: #c4c4c4;
  --m-yellow: #ffd400;
  --m-policy: #4f4200;
  --m-policy-line: #8a7400;
  --err: #a71b45;
  --err-line: #d33460;
  --err-bg: #fff0f5;

  /* размеры по макету (390 pt); ниже по высоте экрана — компактный ряд */
  --ov-pad: 16px;
  --head-pt: 19px;
  --head-pb: 20px;
  --title-fs: 26px;
  --title-lh: 29px;
  --close: 42px;
  --body-px: 17px;
  --body-pt: 17px;
  --body-pb: 22px;
  --plate-py: 10px;
  --plate-px: 12px;
  --sec-mt: 14px;
  --field-h: 44px;
  --field-gap: 8px;
  --ta-h: 63px;
  --consent-mt: 8px;
  --submit-mt: 20px;
  --submit-h: 44px;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: var(--ov-pad) 16px;
  padding-bottom: max(var(--ov-pad), env(safe-area-inset-bottom));
  background: #080808;
  color-scheme: light;
}

.modal {
  position: relative;
  flex: none;
  width: 100%;
  max-width: 420px;
  margin: auto 0;
  border: 1px solid var(--m-edge);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  color: var(--m-ink);
  font-family: Roboto, Arial, sans-serif;
}

.modal-head {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: var(--head-pt) 16px var(--head-pb);
  background: var(--m-head);
  color: #fff;
}

/* тонкая желтая полоса вдоль верха окна */
.modal-head::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 15px;
  right: 15px;
  height: 3px;
  border-radius: 2px;
  background: var(--m-yellow);
}

.modal-head h2 {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: #fff;
  font-family: RobotoCondensed, "Roboto Condensed", Arial, sans-serif;
  font-weight: 700;
  font-size: var(--title-fs);
  line-height: var(--title-lh);
  letter-spacing: 0;
  overflow-wrap: normal;
}

/* фокус переносится на заголовок программно (для скринридера); рамку не рисуем — это не элемент управления */
.modal-head h2:focus,
.modal-head h2:focus-visible { outline: none; }

.close {
  appearance: none;
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: var(--close);
  height: var(--close);
  margin: 0;
  padding: 0;
  border: 1px solid #494949;
  border-radius: 10px;
  background: #262626;
  color: #fff;
  cursor: pointer;
}

/* область нажатия не меньше 44×44 */
.close::after {
  content: "";
  position: absolute;
  inset: calc((var(--close) - 46px) / 2);
}

.close svg { display: block; width: 18px; height: 18px; }
.close:hover { background: #2f2f2f; }
.close:focus-visible { outline: 3px solid var(--m-yellow); outline-offset: 2px; }

.modal-body {
  padding: var(--body-pt) var(--body-px) var(--body-pb);
}

/* серая плашка */
.intro {
  padding: var(--plate-py) var(--plate-px) calc(var(--plate-py) + 1px);
  border-radius: 12px;
  background: var(--m-plate);
}

.intro h3 {
  margin: 0 0 3px;
  color: var(--m-ink);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
}

.intro p {
  margin: 0;
  color: var(--m-text);
  font-size: 13px;
  line-height: 1.4;
}

.intro p + p { margin-top: 4px; }

.form { margin: 0; }

.form-title {
  margin: var(--sec-mt) 0 0;
  color: var(--m-ink);
  font-weight: 700;
  font-size: 18px;
  line-height: 1.2;
}

.req-note {
  margin: 4px 0 8px;
  color: var(--m-muted);
  font-size: 12px;
  line-height: 1.3;
}

.field { position: relative; }
.field + .field { margin-top: var(--field-gap); }

.field input,
.field textarea {
  display: block;
  width: 100%;
  margin: 0;
  border: 1px solid var(--m-field-line);
  border-radius: 8px;
  background: #fff;
  color: var(--m-ink);
  font-family: Roboto, Arial, sans-serif;
  font-size: 16px; /* 16px — чтобы iOS не увеличивал экран при фокусе */
  font-weight: 400;
}

.field input {
  height: var(--field-h);
  padding: 0 13px;
  line-height: 20px;
}

.field textarea {
  height: var(--ta-h);
  padding: 8px 13px;
  line-height: 20px;
  resize: none;
}

.field input::placeholder { color: var(--m-ph); opacity: 1; font-size: 15px; }
.field textarea::placeholder { color: transparent; opacity: 1; }

.field input:focus,
.field textarea:focus { outline: none; border-color: #191919; box-shadow: 0 0 0 1px #191919; }
.field input:focus-visible,
.field textarea:focus-visible { box-shadow: 0 0 0 1px #191919, 0 0 0 4px var(--m-yellow); }

/* двухстрочная подсказка в поле описания */
.ta-ph {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 9px;
  pointer-events: none;
  color: var(--m-ph);
}

.ta-ph b {
  display: block;
  font-weight: 400;
  font-size: 15px;
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ta-ph small {
  display: block;
  margin-top: 3px;
  color: #595959;
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field.is-filled .ta-ph { display: none; }

/* ошибки: без роста высоты */
.field [aria-invalid="true"] { border-color: var(--err-line); background: var(--err-bg); }
.field input[aria-invalid="true"]::placeholder { color: var(--err); }
.field textarea[aria-invalid="true"] + .ta-ph b,
.field textarea[aria-invalid="true"] + .ta-ph small { color: var(--err); }

/* для заполненного, но неверного поля — короткая надпись на верхней рамке */
.field-msg {
  position: absolute;
  top: -8px;
  right: 10px;
  max-width: calc(100% - 20px);
  padding: 0 4px;
  border-radius: 3px;
  background: linear-gradient(#fff 50%, var(--err-bg) 50%);
  color: var(--err);
  font-size: 12px;
  line-height: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.consent {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: var(--consent-mt) 0 0;
  color: var(--m-ink);
  font-size: 12px;
  line-height: 17px;
  cursor: pointer;
}

.consent input {
  appearance: none;
  position: relative;
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 1.5px solid #6a6a6a;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

.consent input:checked { border-color: #191919; background: var(--m-yellow); }
.consent input:checked::after {
  content: "";
  position: absolute;
  left: 5.5px;
  top: 1.5px;
  width: 5px;
  height: 10px;
  border: solid #191919;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* фокус: двойное кольцо, как у полей (темное ≥3:1 на белом + желтое) */
.consent input:focus-visible { outline: 2px solid #191919; outline-offset: 1px; box-shadow: 0 0 0 5px var(--m-yellow); }

.consent a {
  color: var(--m-policy);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--m-policy-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* ссылки в тексте: желтая подложка + темная рамка 2px (≥3:1 на белом), не наползает на соседние строки */
.consent a:focus-visible { outline: 2px solid #191919; outline-offset: 1px; background: var(--m-yellow); border-radius: 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

.consent:has(input[aria-invalid="true"]) {
  margin-left: -8px;
  margin-right: -8px;
  margin-bottom: -8px;
  padding: 0 8px 8px;
  padding-top: 0;
  border-radius: 8px;
  outline: 1px solid var(--err-line);
  background: var(--err-bg);
  color: var(--err);
}

.consent:has(input[aria-invalid="true"]) input { border-color: var(--err-line); }

/* короткая надпись ошибки согласия на рамке блока — высоту не меняет */
.consent .field-msg { top: auto; bottom: -8px; right: 10px; background: linear-gradient(var(--err-bg) 50%, #fff 50%); }

.submit {
  appearance: none;
  display: block;
  width: 100%;
  height: var(--submit-h);
  margin: var(--submit-mt) 0 0;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: var(--m-yellow);
  color: var(--m-ink);
  font-family: Roboto, Arial, sans-serif;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}

.submit:hover { background: #ffdc2e; }
.submit:focus-visible { outline: 3px solid #191919; outline-offset: 2px; }
.submit[aria-busy="true"] { opacity: 0.7; cursor: progress; }

/* футер окон: под окном на темной подложке, последняя строка прокручиваемой области */
.modal-foot {
  width: 100%;
  max-width: 420px;
  margin-top: 6px;
  padding: 0 4px;
  min-height: 24px;
}

/* ===== «Спасибо» ===== */
.thanks { text-align: center; }

.thanks-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 4px auto 14px;
  border-radius: 50%;
  background: var(--m-yellow);
}

.thanks-icon svg { width: 28px; height: 28px; }

.thanks strong { color: var(--m-ink); font-weight: 700; }

.thanks p {
  margin: 0 auto;
  max-width: 17em;
  color: var(--m-text);
  font-size: 15px;
  line-height: 1.4;
  text-wrap: balance;
}

/* ===== «Вопросы и ответы» ===== */
.modal.is-faq {
  display: flex;
  flex-direction: column;
  max-height: 100%;
}

.overlay.is-faq-open .modal { flex: 1 1 auto; min-height: 0; }

.modal.is-faq .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 12px 16px;
  background: #f3f3f1;
}

.faq-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }

.faq-item {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.07);
  overflow: hidden;
}

.faq-item h3 { margin: 0; }

.faq-q {
  appearance: none;
  position: relative;
  display: block;
  width: 100%;
  min-height: 46px;
  margin: 0;
  padding: 13px 40px 13px 14px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #111;
  text-align: left;
  font-family: RobotoCondensed, "Roboto Condensed", Arial, sans-serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  cursor: pointer;
}

.faq-q::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-70%) rotate(45deg);
}

.faq-q[aria-expanded="true"]::after { transform: translateY(-20%) rotate(225deg); }
.faq-q:focus-visible { outline: 2px solid #191919; outline-offset: -2px; box-shadow: inset 0 0 0 5px var(--m-yellow); }

.faq-a {
  padding: 0 14px 14px;
  color: #111;
  font-size: 14.5px;
  line-height: 1.4;
}

.faq-a p { margin: 0 0 8px; }
.faq-a p:last-of-type { margin-bottom: 0; }

.faq-a a { color: #111; text-underline-offset: 2px; }
.faq-a a:focus-visible,
.faq-source:focus-visible { outline: 2px solid #191919; outline-offset: 1px; background: var(--m-yellow); color: #191919; border-radius: 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

.faq-source {
  display: inline-block;
  margin-top: 8px;
  color: #5c5c5c;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ===== Невысокие экраны (375×667 и подобные): все еще без прокрутки ===== */
@media (max-height: 759px) {
  :root {
    --ov-pad: 8px;
    --head-pt: 13px;
    --head-pb: 13px;
    --title-fs: 24px;
    --title-lh: 27px;
    --close: 40px;
    --body-px: 14px;
    --body-pt: 12px;
    --body-pb: 16px;
    --plate-py: 8px;
    --plate-px: 11px;
    --sec-mt: 10px;
    --field-h: 40px;
    --field-gap: 6px;
    --ta-h: 58px;
    --consent-mt: 8px;
    --submit-mt: 16px;
    --submit-h: 44px;
  }

  .req-note { margin-bottom: 6px; }

  /* t143u: футер под окном помещается без прокрутки — ужаты только поля подложки, сама форма та же */
  .overlay { padding-top: 4px; padding-bottom: max(2px, env(safe-area-inset-bottom)); }
  .modal-foot { margin-top: 0; min-height: 16px; }
  .ta-ph { top: 7px; }
  .field textarea { padding-top: 6px; }
}

/* ===== Узкие телефоны (320): пропорции как на 375, прокрутка внутри окна допустима ===== */
@media (max-width: 359px) {
  .overlay { padding-left: 8px; padding-right: 8px; }
  :root { --body-px: 12px; --title-fs: 22px; --title-lh: 25px; }
  .modal-head { padding-left: 12px; padding-right: 12px; }
  .modal-head::before { left: 11px; right: 11px; }
  .field input, .field textarea { padding-left: 11px; padding-right: 11px; }
  .ta-ph { left: 12px; right: 12px; }
  .ta-ph small { font-size: 11px; }
}

/* ===== Планшет и шире ===== */
@media (min-width: 700px) {
  .overlay { padding: 32px; }
}

/* ===== t151u: картинка в шапке не липнет к плиткам =====
   Низ картинки поднят на --art-lift (шапка той же высоты), картинка чуть уменьшается по месту.
   Видимый зазор «колеса/дорога — верх плиток» ≈ шаг сетки. */
:root { --art-lift: 15px; }
.art {
  top: var(--title-row);
  bottom: var(--art-lift);
  height: calc(100% - var(--title-row) - var(--art-lift));
  max-height: none;
  width: auto;
  max-width: 58%;
}

/* ===== t155u, t158u: «— помощник» мельче (22→19→16px, на ≤340: 16→14→12px).
   Логотип и высота шапки прежние; базовая линия текста осталась там же, где была. ===== */
.hero h1 .h1-text { font-size: 16px; position: relative; top: 2px; }
@media (max-width: 340px) {
  .hero h1 .h1-text { font-size: 12px; top: 1px; }
}

/* ===== t157u, t159u: картинка в шапке =====
   Размер как в t154u: высота = шапка − ряд заголовка − 15px, но не шире 58% колонки.
   По вертикали — посередине между верхом шапки (под желтой полосой) и верхом плиток:
   отступ сверху до видимых пикселей = отступ от видимого низа до плиток.
   В файле прозрачные поля: сверху 6/399, снизу 6/399 (видимые строки 6–392), справа 10/399 высоты.
   Справа — как отступ текста слева (16px, на ≤340 — 12px). */
:root { --art-pad-r: 16px; --main-pt: 4px; }
@media (max-width: 340px) { :root { --art-pad-r: 12px; } }
@media (max-height: 640px) { :root { --main-pt: 2px; } }
.art {
  --art-h: min(calc(var(--hero-h) - var(--title-row) - 15px), calc(min(100vw, 480px) * 0.58 * 0.399));
  top: calc((var(--hero-h) + var(--main-pt) - var(--art-h) * 387 / 399) / 2 - var(--art-h) * 6 / 399);
  right: calc(var(--art-pad-r) - var(--art-h) * 10 / 399);
  bottom: auto;
  height: var(--art-h);
  width: auto;
  max-width: none;
  max-height: none;
}
/* 341–380px: рядом с «— помощник» 16px хвост дороги ближе 8px к тексту — картинку чуть уменьшаем
   (341px: −12%, 360px: −6%, 371px: −2%; с 372px — полный размер); сдвинуть вправо нельзя: справа 16px. */
@media (min-width: 341px) and (max-width: 371px) {
  .art { --art-h: min(calc(var(--hero-h) - var(--title-row) - 15px), calc(43.3vw - 90.5px)); }
}

/* ===== t160u: плитки выше — шапка ниже на 10% (на 375: 136 → 122,4px).
   --hero-h остается мерой для размера картинки (картинка того же размера),
   фактическая высота шапки — --hero-real; картинка посередине по ней. ===== */
:root { --hero-real: calc(var(--hero-h) * 0.9); }
.hero { min-height: var(--hero-real); }
.art {
  top: calc((var(--hero-real) + var(--main-pt) - var(--art-h) * 387 / 399) / 2 - var(--art-h) * 6 / 399);
}
/* t160u: при более низкой шапке картинка ближе к «— помощник»; на 341–378px — минимальное уменьшение
   (375px: 73 → 71,5px по высоте, −2%), чтобы до текста было ≥8px. */
@media (min-width: 341px) and (max-width: 378px) {
  .art { --art-h: min(calc(var(--hero-h) - var(--title-row) - 15px), calc(48.5vw - 110.4px)); }
}
