/* =========================================================
   Ключевые параметры — удобно подкручивать вручную
   ========================================================= */
:root {
  --flap-top-duration: 0.9s;
  --flap-bottom-duration: 0.9s;
  --flap-bottom-delay-open: 0.2s;
  --flap-top-delay-close: 0.45s;
  --card-duration: 0.55s;
  --card-delay-open: 0.35s;
  --hover-flap-angle: 11deg;
  --ease-flap: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-card: cubic-bezier(0.33, 0, 0.2, 1);

  /* Дизайн в долях сцены (580 × 1078) */
  --design-w: 580;
  --design-h: 1076; /* top 338 + body 369 + bottom 369 */
  --top-flap-h: 338;
  --body-h: 369;
  --bottom-flap-h: 369;
  --fold-top: 338;
  --fold-bottom: 707;

  /* PNG клапана = размер основы (579×369), без сжатия в 342 */
  --flap-top-closed-h: 369;
  --card-w: 486;
  --card-h: 305;
  --holders-w: 517;
  --holders-h: 91;

  --envelope-blue: #008eeb;
  /* бумага как в Figma (pattern + Plus Darker) на CSS-основе конверта */
  --envelope-texture: url("Объекты/текстура.png");
  --envelope-radius: 32px;

  --bg: #eef3f8;
  --ink: #1a2b3c;
  --muted: #5b6b7c;
  --btn-bg: #2f6fed;
  --btn-bg-hover: #2560d4;
  --shadow-card: 0 14px 32px rgba(30, 60, 100, 0.18);
  --shadow-card-rest: 0 4px 14px rgba(30, 60, 100, 0.08);
}

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

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "Manrope", sans-serif;
  background: #ffffff;
  color: #1b1b1b;
  overflow: hidden;
}

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

/* ---------- Страница: десктоп / ноутбуки ----------
   ≥1200: Frame 77 — (intro+форма) слева | конверт справа.
   Full HD / 2K: тот же layout, свои пропорции (шрифты, gift-w).
   Конверт вниз не переносим при ширине ≥1200.
*/
.app {
  --page-pad-x: 48px;
  --page-max-w: 1920px;
  --page-gap: 128px;
  --content-stack-gap: 100px;
  --gift-max: 460px;
  --content-max: 711px;
  --ui-title: 40px;
  --ui-title-lh: 42px;
  --ui-sub: 20px;
  --ui-sub-lh: 24px;
  /* поле: эталон 60×40/55/pad20 — на всех ширинах от --form-row-h */
  --form-row-h: 60px;
  --ui-input: calc(var(--form-row-h) * 40 / 60);
  --ui-input-lh: calc(var(--form-row-h) * 55 / 60);
  --ui-input-pad-top: calc(var(--form-row-h) * 20 / 60);
  --ui-error: 16px;
  --ui-error-lh: 22px;
  /* одна переменная для конверта и высоты текстового блока */
  --gift-w: min(
    var(--gift-max),
    calc((100vh - 120px) * var(--design-w) / 900),
    calc((100dvh - 120px) * var(--design-w) / 900)
  );
  position: relative;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  background: #ffffff;
}

/* Тот же max-width + pad, что у .site-main — лого вровень с левым текстом */
.site-header {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  box-sizing: border-box;
  width: 100%;
  max-width: var(--page-max-w);
  padding: 32px var(--page-pad-x) 0;
}

.logo {
  display: block;
  width: 207px;
  height: auto;
}

.site-main {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: var(--page-gap);
  padding: 0 var(--page-pad-x);
  width: 100%;
  max-width: var(--page-max-w);
  margin: 0 auto;
  box-sizing: border-box;
}

/* Бывший cert__note: ПК — всегда; compact — только при открытом конверте */
.page-disclaimer {
  display: none;
  flex: 0 0 auto;
  margin: 0;
  padding: 8px var(--page-pad-x) max(12px, env(safe-area-inset-bottom, 0px));
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  font-family: "Manrope", sans-serif;
  font-style: normal;
  font-weight: 300;
  font-size: 12px;
  line-height: 16px;
  color: #5b6b7c;
}

@media (min-width: 1200px) {
  .page-disclaimer {
    display: block;
  }
}

@media (max-width: 1199.98px) {
  .app[data-state="success"] .page-disclaimer {
    display: block;
    white-space: nowrap;
    padding-top: 6px;
    padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
  }
}

/* телефон: мельче, в одну строку */
@media (max-width: 640.98px) {
  .app[data-state="success"] .page-disclaimer {
    font-size: clamp(8px, 2.55vw, 10px);
    line-height: 1.3;
  }
}

/* длинный телефон: 10px снизу съедает панель браузера / индикатор */
@media (max-width: 640.98px) and (min-height: 740px) {
  .app[data-state="success"] .page-disclaimer {
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  }
}

/* планшет 641–1199: крупнее, ближе к десктопу */
@media (min-width: 641px) and (max-width: 1199.98px) {
  .app[data-state="success"] .page-disclaimer {
    font-size: clamp(12px, 1.35vw, 14px);
    line-height: 1.35;
  }
}

/* Frame 77: intro + форма; высота = закрытый конверт, gap до конверта ≥128 */
.content-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--content-stack-gap);
  flex: 1 1 auto;
  min-width: 0;
  max-width: var(--content-max);
  height: calc(var(--gift-w) * var(--body-h) / var(--design-w));
  max-height: calc(var(--gift-w) * var(--body-h) / var(--design-w));
  box-sizing: border-box;
  z-index: 1;
}

.intro {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 24px;
  width: 100%;
  z-index: 1;
}

.intro__copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 8px;
  /* ПК: ширина по тексту — подарок сразу справа, не у края колонки */
  flex: 0 1 auto;
  width: max-content;
  max-width: calc(100% - 12px - 80px);
  min-width: 0;
}

.intro__title {
  margin: 0;
  width: auto;
  max-width: 100%;
  font-family: "Manrope", sans-serif;
  font-style: normal;
  font-weight: 500;
  font-size: var(--ui-title);
  line-height: var(--ui-title-lh);
  color: #1b1b1b;
}

.intro__text {
  margin: 0;
  width: auto;
  max-width: 100%;
  font-family: "Manrope", sans-serif;
  font-style: normal;
  font-weight: 300;
  font-size: var(--ui-sub);
  line-height: var(--ui-sub-lh);
  color: #1b1b1b;
}

/* ПК: высота подарка = блок intro (title + gap + text) */
.intro__gift {
  flex: 0 0 auto;
  height: calc(var(--ui-title-lh) + 8px + var(--ui-sub-lh));
  width: auto;
  max-width: 40%;
  line-height: 0;
}

.intro__gift img {
  display: block;
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: center left;
  pointer-events: none;
  user-select: none;
}

/* Перенос только между фразами — и только если не помещается в одну строку */
.intro__nowrap {
  white-space: nowrap;
}

.gift-area {
  position: relative;
  flex: 0 0 var(--gift-w);
  width: var(--gift-w);
  height: calc(var(--gift-w) * var(--body-h) / var(--design-w));
  z-index: 2;
  overflow: visible;
}

.card-entry {
  position: relative;
  width: 100%;
  max-width: 100%;
  z-index: 1;
}

/* Форма номера карты */
.card-form {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

.card-form__row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
  height: var(--form-row-h);
}

.card-form__field {
  position: relative;
  flex: 1 1 auto;
  align-self: stretch;
  min-width: 0;
  height: var(--form-row-h);
}

.card-form__input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  height: var(--form-row-h);
  border: 0;
  outline: none;
  background: transparent;
  font-family: "Manrope", sans-serif;
  font-style: normal;
  font-weight: 500;
  font-size: var(--ui-input);
  line-height: var(--ui-input-lh);
  color: #1b1b1b;
  margin: 0;
  padding: var(--ui-input-pad-top) 0 0 0;
}

.card-form__input::placeholder {
  color: rgba(27, 27, 27, 0.35);
  opacity: var(--placeholder-opacity, 1);
  transition: var(--placeholder-transition, opacity 0.45s ease);
  line-height: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.app[data-state="success"] .card-form__input {
  cursor: text;
}

.card-form__submit {
  position: relative;
  flex: 0 0 auto;
  width: auto;
  min-width: 60px; /* одна стрелка ввода */
  height: var(--form-row-h);
  border: 0;
  padding: 0;
  margin-left: auto;
  background: #ffffff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.card-form__submit:disabled {
  cursor: default;
}

/* без transform на :active — иначе на мыши click срывается */
.card-form__submit:active:not(:disabled),
.card-form__submit.is-pressed:not(:disabled) {
  filter: brightness(0.92);
}

.card-form__submit.is-pressing:not(:disabled) {
  animation: ui-press 0.28s ease;
}

.card-form__icons {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  width: 100%;
  height: var(--form-row-h);
  box-sizing: border-box;
}

/* Иконка 60×60 (на 2K масштабируется CSS; fill — чтобы SVG реально рос) */
.card-form__icons img {
  display: block;
  flex: 0 0 60px;
  width: 60px;
  height: 60px;
  max-width: 60px;
  max-height: 60px;
  object-fit: fill;
}

.card-form__rule {
  width: 100%;
  height: 0;
  border-top: 2px solid #1b1b1b;
}

/* Ошибка под формой — не влияет на выравнивание колонок */
.card-form__error {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  margin: 0;
  width: 100%;
  font-family: "Manrope", sans-serif;
  font-style: normal;
  font-weight: 300;
  font-size: var(--ui-error);
  line-height: var(--ui-error-lh);
  color: #1b1b1b;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.card-form__error.is-visible {
  opacity: 1;
  visibility: visible;
}

/* Состояния страницы */
.app[data-state="entry"] .card-form__icons--success,
.app[data-state="error"] .card-form__icons--success {
  display: none !important;
}

.app[data-state="success"] .card-form__icons--entry {
  display: none !important;
}

.stage {
  position: absolute;
  left: 0;
  /* % от высоты gift-area (= body) — всегда совпадает с реальным конвертом */
  top: calc(-100% * var(--fold-top) / var(--body-h));
  width: 100%;
  height: calc(100% * var(--design-h) / var(--body-h));
  overflow: visible;
  /* 3D-сцена в своём слое — не мылит лого/input на странице */
  isolation: isolate;
  transform: translateZ(0);
}

/*
  Frame 72: шире конверта (697/460).
  Выше и длиннее сцены — иначе на ПК частицы упираются в край canvas
  и «обрезаются», не доходя до верха конверта.
  Буфер синхронизируется в JS с CSS-размером.
*/
.confetti-canvas {
  position: absolute;
  left: 50%;
  top: -42%;
  width: 151.5217%; /* 697 / 460 — Frame 72 */
  height: 185%;
  transform: translateX(-50%);
  pointer-events: none;
  /* за сценой: по бокам конверта, не поверх клапанов/карты */
  z-index: 0;
}

.scene {
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
  overflow: visible;
}

.scene,
.scene__scaler,
.envelope {
  overflow: visible;
}

.scene__scaler {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.envelope {
  position: relative;
  width: 100%;
  height: 100%;
  /* -webkit- нужен Яндексу: без префикса preserve-3d конверт не рисуется */
  -webkit-perspective: 1200px;
  perspective: 1200px;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}

.envelope:focus-visible {
  outline: 3px solid rgba(47, 111, 237, 0.45);
  outline-offset: 6px;
}

.layer {
  position: absolute;
  pointer-events: none;
}

.layer img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  -webkit-user-drag: none;
}

/* карта — PNG напрямую (не SVG-pattern с scale 0.0004 — Chrome мылит) */

/* ---------- Основа ----------
   Голубой + текстура 20% / Plus Darker.
   Чуть заходим за сгиб (±3px) — стык с клапаном без линии.
*/
.base {
  left: 0;
  top: calc((var(--fold-top) - 3) / var(--design-h) * 100%);
  width: 100%;
  height: calc((var(--body-h) + 6) / var(--design-h) * 100%);
  z-index: 2;
  border-radius: 0;
  background-color: var(--envelope-blue);
  isolation: isolate;
}

/* Текстура на всю основу включая перекрытие сгиба */
.base::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: var(--envelope-texture);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  opacity: 0.2;
  mix-blend-mode: multiply;
  mix-blend-mode: plus-darker;
}

/* ---------- Карта ---------- */
.card {
  left: calc((var(--design-w) - var(--card-w)) / 2 / var(--design-w) * 100%);
  top: calc((var(--fold-top) + (var(--body-h) - var(--card-h)) / 2) / var(--design-h) * 100%);
  width: calc(var(--card-w) / var(--design-w) * 100%);
  height: calc(var(--card-h) / var(--design-h) * 100%);
  z-index: 4;
  transform: scale(0.985);
  transform-origin: center center;
  transition:
    transform var(--card-duration) var(--ease-card),
    filter var(--card-duration) var(--ease-card);
  transition-delay: 0s;
  will-change: transform;
  container-type: size;
}

/* Номинал на лице карты (Frame / mockup: «5000 ₽» справа сверху) */
.card__nominal {
  position: absolute;
  right: 7%;
  top: 11%;
  z-index: 2;
  margin: 0;
  padding: 0;
  text-align: right;
  color: #ffffff;
  pointer-events: none;
  user-select: none;
}

.card__nominal[hidden] {
  display: none !important;
}

.card__nominal-amount {
  display: block;
  font-family: "Manrope", sans-serif;
  font-style: normal;
  font-weight: 700;
  font-size: 20px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.card__number,
.cert-export__card-number {
  position: absolute;
  right: 7%;
  bottom: 8%;
  z-index: 3;
  color: #ffffff;
  font-family: "Manrope", sans-serif;
  font-weight: 500;
  font-size: 18px;
  line-height: 1.2;
  white-space: nowrap;
  text-align: right;
  pointer-events: none;
}

.envelope.is-open .card {
  transform: scale(1);

  transition-delay: var(--card-delay-open);
}

/* ---------- Держатели ---------- */
.holders {
  left: calc((var(--design-w) - var(--holders-w)) / 2 / var(--design-w) * 100%);
  top: calc((var(--fold-top) + (var(--body-h) - var(--holders-h)) / 2) / var(--design-h) * 100%);
  width: calc(var(--holders-w) / var(--design-w) * 100%);
  height: calc(var(--holders-h) / var(--design-h) * 100%);
  z-index: 5;
}

/* ---------- Общие лица клапанов ---------- */
.flap {
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  will-change: transform;
}

.flap__face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  overflow: hidden;
}

.flap__face--front {
  -webkit-transform: rotateX(0deg);
  transform: rotateX(0deg);
}

.flap__face--back {
  -webkit-transform: rotateX(180deg);
  transform: rotateX(180deg);
}

/* ---------- Верхний клапан ----------
   Ширина/высота = основа (100% × body-h), PNG 579×369 без сжатия.
*/
.flap--top {
  left: 0;
  top: calc(var(--fold-top) / var(--design-h) * 100%);
  width: 100%;
  height: calc(var(--body-h) / var(--design-h) * 100%);
  z-index: 12;
  -webkit-transform-origin: 50% 0%;
  transform-origin: 50% 0%;
  -webkit-transform: rotateX(0deg);
  transform: rotateX(0deg);
  /* без overflow — иначе 3D сплющивается и вместо раскрытый виден перевёрнутый закрытый */
  transition:
    transform var(--flap-top-duration) var(--ease-flap),
    z-index 0s linear calc(var(--flap-top-duration) * 0.5);
}

.envelope.is-open .flap--top {
  -webkit-transform: rotateX(180deg);
  transform: rotateX(180deg);
  z-index: 1;
  transition-delay: 0s, calc(var(--flap-top-duration) * 0.5);
}

.envelope:not(.is-open) .flap--top {
  transition-delay: var(--flap-top-delay-close), var(--flap-top-delay-close);
}

.envelope:not(.is-open):not(.is-busy):hover .flap--top {
  -webkit-transform: rotateX(var(--hover-flap-angle));
  transform: rotateX(var(--hover-flap-angle));
  transition-duration: 0.35s;
  transition-delay: 0s;
}

.envelope:not(.is-open):not(.is-busy) .flap--top {
  transition-duration: 0.35s, 0s;
  transition-delay: 0s, 0s;
}

.envelope:not(.is-open).is-busy .flap--top,
.envelope.is-open .flap--top {
  transition-duration: var(--flap-top-duration), 0s;
}

/* PNG 1:1 с основой — без object-fit squeeze */
.flap--top .flap__face img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: fill;
  object-position: center top;
  image-rendering: auto;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.holders img {
  image-rendering: auto;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* ---------- Нижний клапан (одна створка, две стороны) ----------
   Лицевая — голубая (закрыто).
   Обратная — белая с текстом (открыто).
   Без подмены на цвет фона и без отдельного fade-слоя.
*/
.flap--bottom {
  left: 0;
  top: calc(var(--fold-top) / var(--design-h) * 100%);
  width: 100%;
  height: calc(var(--bottom-flap-h) / var(--design-h) * 100%);
  z-index: 8;
  -webkit-transform-origin: 50% 100%;
  transform-origin: 50% 100%;
  -webkit-transform: rotateX(0deg);
  transform: rotateX(0deg);
  transition:
    transform var(--flap-bottom-duration) var(--ease-flap),
    z-index 0s linear calc(var(--flap-bottom-duration) * 0.5);
}

.envelope.is-open .flap--bottom {
  -webkit-transform: rotateX(-180deg);
  transform: rotateX(-180deg);
  z-index: 3;
  transition-delay: var(--flap-bottom-delay-open),
    calc(var(--flap-bottom-delay-open) + var(--flap-bottom-duration) * 0.5);
}

.envelope:not(.is-open) .flap--bottom {
  transition-delay: 0s, calc(var(--flap-bottom-duration) * 0.5);
}

/*
  Close: сразу z-index 8 (не ждать половину duration).
  Иначе при transform-style:flat карта (z=4) торчит поверх клапана.
*/
.envelope:not(.is-open).is-busy .flap--bottom {
  z-index: 8;
  transition-delay: 0s, 0s;
}

.envelope:not(.is-open).is-busy .card,
.envelope:not(.is-open).is-busy .holders {
  z-index: 2;
  transition-delay: 0s;
}

/* Без скруглений/обводки; тень только в покое — не на is-busy/open (3D flip) */
.flap--bottom .flap__face--front {
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 42, 74, 0.14);
  transition: box-shadow 0.2s ease;
}

.envelope.is-open .flap--bottom .flap__face--front,
.envelope.is-busy .flap--bottom .flap__face--front {
  box-shadow: none;
  transition: none;
}

.flap--bottom .flap__face--front img {
  width: 100%;
  height: 100%;
  object-fit: fill;
}

/* Белая внутренняя сторона — без обводки и скруглений */
.bottom-back {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  background: #ffffff;
  border: 0;
  border-radius: 0;
  box-shadow: 0 4px 16px rgba(0, 42, 74, 0.1);
  container-type: size;
  container-name: cert-panel;
}

.flap--bottom .flap__face--back {
  overflow: visible;
}

.flap--bottom .bottom-back.is-tall {
  inset: auto;
  top: 0;
  left: 0;
  right: 0;
  bottom: auto;
  width: 100%;
}

.envelope.is-open .flap--bottom .cert {
  pointer-events: auto;
}

/*
  Панель сертификата — fill по высоте: верх сверху, кнопки снизу,
  свободное место уходит в зазор между ними (≥ телефонный min 20px).
  Услуга ≤4 строки; типографика как раньше.
*/
.cert {
  --cert-fit: 1;
  --cert-pad-x: max(14px, calc(5.217cqw * var(--cert-fit))); /* 24/460 */
  --cert-pad-y: max(14px, calc(5.217cqw * var(--cert-fit))); /* 24/460 */
  /* минимум зазора верх↔кнопки — как на телефоне */
  --cert-gap-min: 20px;
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-end;
  padding: var(--cert-pad-y) var(--cert-pad-x);
  gap: 0;
  overflow: hidden;
  font-family: "Manrope", sans-serif;
  color: #1b1b1b;
  pointer-events: none;
}

.cert__top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: max(8px, calc(2.609cqw * var(--cert-fit))); /* 12/460 */
  width: 100%;
  flex: 0 0 auto;
}

.cert__title {
  margin: 0;
  width: 100%;
  font-family: "Manrope", sans-serif;
  font-style: normal;
  font-weight: 600;
  font-size: max(22px, calc(5.652cqw * var(--cert-fit))); /* 26/460 */
  line-height: max(28px, calc(7.826cqw * var(--cert-fit))); /* 36/460 */
  text-align: center;
  color: #1b1b1b;
}

.cert__service-wrap {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: max(6px, calc(1.739cqw * var(--cert-fit)));
  width: 100%;
  min-width: 0;
}

.cert__service {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  font-family: "Manrope", sans-serif;
  font-style: normal;
  font-weight: 400;
  font-size: max(14px, calc(3.478cqw * var(--cert-fit))); /* 16/460 */
  line-height: max(18px, calc(4.783cqw * var(--cert-fit))); /* 22/460 */
  color: #1b1b1b;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
}

/* i в круге — только мобилка, когда название обрезано */
.cert__service-info {
  appearance: none;
  flex: 0 0 auto;
  display: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
}

.cert__service-info[hidden] {
  display: none !important;
}

.cert__service-info-icon {
  display: block;
  width: 20px;
  height: 20px;
}

/* Apple-style dismiss sheet — полный текст услуги на мобилке */
.service-sheet {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  padding: 0 8px calc(8px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  pointer-events: none;
}

.service-sheet[hidden] {
  display: none !important;
}

.service-sheet.is-open {
  pointer-events: auto;
}

.service-sheet__backdrop {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.28);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.service-sheet__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  transform: translateY(110%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}

.service-sheet.is-open .service-sheet__panel {
  transform: translateY(0);
}

.service-sheet__text {
  margin: 0;
  padding: 16px 16px 14px;
  font-family: "Manrope", sans-serif;
  font-weight: 400;
  font-size: 13px;
  line-height: 18px;
  text-align: center;
  color: rgba(60, 60, 67, 0.72);
}

.service-sheet__close {
  appearance: none;
  display: block;
  width: 100%;
  margin: 0;
  padding: 16px;
  border: 0;
  border-top: 0.5px solid rgba(60, 60, 67, 0.18);
  background: transparent;
  font-family: "Manrope", sans-serif;
  font-weight: 500;
  font-size: 17px;
  line-height: 22px;
  text-align: center;
  color: #007aff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.service-sheet__close:active {
  background: rgba(60, 60, 67, 0.08);
}

/* иконка i — когда услуга не влезла в 4 строки (все ширины) */
.cert__service-info.is-visible:not([hidden]) {
  display: inline-flex;
}

.cert__balance {
  margin: 0;
  width: 100%;
  font-family: "Manrope", sans-serif;
  font-style: normal;
  font-weight: 400;
  font-size: max(16px, calc(4.348cqw * var(--cert-fit))); /* 20/460 */
  line-height: max(22px, calc(5.87cqw * var(--cert-fit))); /* 27/460 */
  color: #1b1b1b;
}

.cert__service[hidden],
.cert__balance[hidden] {
  display: none !important;
}

.cert[data-type="nominal"] .cert__service {
  display: none !important;
}

.cert[data-type="service"] .cert__balance {
  display: none !important;
}

.cert__meta {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: baseline;
  gap: max(10px, calc(3.478cqw * var(--cert-fit))); /* 16/460 */
  width: 100%;
}

.cert__number,
.cert__dates {
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
  font-family: "Manrope", sans-serif;
  font-style: normal;
  font-weight: 500;
  font-size: max(14px, calc(4.13cqw * var(--cert-fit))); /* 19/460 */
  line-height: max(18px, calc(5.652cqw * var(--cert-fit))); /* 26/460 */
  color: #1b1b1b;
}

.cert__bottom {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: max(8px, calc(2.609cqw * var(--cert-fit))); /* 12/460 */
  width: 100%;
  flex: 0 0 auto;
  /* fill: кнопки к низу панели; зазор ≥ --cert-gap-min */
  margin-top: auto;
  padding-top: max(var(--cert-gap-min), var(--cert-pad-y));
}

.cert__dates,
.cert-export__dates {
  margin-left: auto;
  text-align: right;
}

.cert__actions {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: stretch;
  gap: max(8px, calc(2.609cqw * var(--cert-fit))); /* 12/460 */
  width: 100%;
}

.btn {
  appearance: none;
  box-sizing: border-box;
  display: inline-flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  padding: max(8px, calc(2.174cqw * var(--cert-fit)))
    max(14px, calc(5.217cqw * var(--cert-fit))); /* 10 24 */
  gap: max(8px, calc(2.174cqw * var(--cert-fit)));
  border-radius: max(8px, calc(1.739cqw * var(--cert-fit))); /* 8/460 */
  font-family: "Manrope", sans-serif;
  font-style: normal;
  font-size: max(14px, calc(3.043cqw * var(--cert-fit))); /* 14/460 */
  line-height: max(18px, calc(4.783cqw * var(--cert-fit))); /* 22/460 */
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

/*
  Оффскрин-экспорт: всегда за экраном (не мигает на сайте).
  Рамка с полями → целиком в PDF/JPG.
*/
.cert-export {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 520px;
  padding: 0;
  margin: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 1;
  visibility: visible;
}

.cert-export__frame {
  box-sizing: border-box;
  width: 520px;
  padding: 30px;
  background: #ffffff;
}

.cert-export__envelope {
  box-sizing: border-box;
  width: 460px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: #ffffff;
  font-family: "Manrope", sans-serif;
  color: #1b1b1b;
}

.cert-export__flap-top {
  position: relative;
  width: 100%;
  height: calc(460px * 369 / 580);
  line-height: 0;
  overflow: hidden;
  background: transparent;
}

.cert-export__flap-top img {
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: none;
  object-fit: fill;
}

.cert-export__body {
  position: relative;
  width: 100%;
  height: calc(460px * 369 / 580);
  overflow: hidden;
  background-color: var(--envelope-blue);
  isolation: isolate;
}

.cert-export__body::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: var(--envelope-texture);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  opacity: 0.2;
  mix-blend-mode: multiply;
  mix-blend-mode: plus-darker;
  z-index: 1;
}

.cert-export__card-art {
  position: absolute;
  left: calc((580 - 486) / 2 / 580 * 100%);
  top: calc((369 - 305) / 2 / 369 * 100%);
  width: calc(486 / 580 * 100%);
  height: calc(305 / 369 * 100%);
  z-index: 2;
}

.cert-export__card-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.cert-export__nominal {
  position: absolute;
  right: 7%;
  top: 14%;
  z-index: 3;
  margin: 0;
  padding: 0;
  text-align: right;
  color: #ffffff;
}

.cert-export__nominal[hidden] {
  display: none !important;
}

.cert-export__face {
  display: block;
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: 20px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.cert-export__holders {
  position: absolute;
  left: calc((580 - 517) / 2 / 580 * 100%);
  top: calc((369 - 91) / 2 / 369 * 100%);
  width: calc(517 / 580 * 100%);
  height: calc(91 / 369 * 100%);
  z-index: 4;
}

.cert-export__holders img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.cert-export__panel {
  box-sizing: border-box;
  width: 100%;
  min-height: calc(460px * 280 / 580);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 16px;
  background: #ffffff;
  border: 0;
  border-radius: 0;
  box-shadow: 0 4px 16px rgba(0, 42, 74, 0.1);
}

.cert-export__top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
}

.cert-export__title {
  margin: 0;
  width: 100%;
  font-weight: 600;
  font-size: 26px;
  line-height: 36px;
  text-align: center;
}

.cert-export__service,
.cert-export__balance {
  margin: 0;
  width: 100%;
  font-weight: 400;
  font-size: 16px;
  line-height: 22px;
  overflow-wrap: anywhere;
}

.cert-export__service {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

.cert-export__balance {
  font-size: 20px;
  line-height: 27px;
}

.cert-export__service[hidden],
.cert-export__balance[hidden] {
  display: none !important;
}

.cert-export__panel[data-type="nominal"] .cert-export__service {
  display: none !important;
}

.cert-export__panel[data-type="service"] .cert-export__balance {
  display: none !important;
}

.cert-export__meta {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px 16px;
  width: 100%;
}

.cert-export__number,
.cert-export__dates {
  font-weight: 500;
  font-size: 19px;
  line-height: 26px;
  white-space: nowrap;
}

.cert-export__note {
  margin: 0;
  width: 100%;
  font-weight: 300;
  font-size: 12px;
  line-height: 16px;
}

/*
  Текст вне perspective → без мыла.
  top = fold-bottom в % сцены (стабильно, без прыжка от 3D getBoundingClientRect).
*/
.panel-flat {
  position: absolute;
  left: 0;
  width: 100%;
  top: calc(var(--fold-bottom) / var(--design-h) * 100%);
  box-sizing: border-box;
  z-index: 20;
  margin: 0;
  padding: 0;
  pointer-events: auto;
}

/* на всех ширинах: cert по умолчанию none — кнопки в flat должны ловить клики */
.panel-flat .cert,
.panel-flat .btn {
  pointer-events: auto;
}

.panel-flat[hidden] {
  display: none !important;
}

.panel-flat .bottom-back {
  position: relative;
  inset: auto;
  width: 100%;
  height: auto;
  aspect-ratio: var(--design-w) / var(--bottom-flap-h);
  min-height: 0;
  container-type: size;
  container-name: cert-panel;
}

.panel-flat .bottom-back.is-tall {
  aspect-ratio: auto;
}

.panel-flat .cert {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* Рост панели ровно под контент — без дыр space-between */
.panel-flat .bottom-back.is-tall .cert,
.flap--bottom .bottom-back.is-tall .cert {
  justify-content: flex-start;
}

.envelope.is-settled .flap--bottom .flap__face--back {
  visibility: hidden;
}

/* открытие: высокая панель сертификата не клипается — высота уже финальная, без скачка на settle */
.envelope.is-open .flap--bottom .flap__face--back {
  overflow: visible;
}

/*
  Press-pulse после click (не на mousedown):
  scale во время зажатия на мыши срывает click — курсор «съезжает» с кнопки.
*/
@keyframes ui-press {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(0.92);
  }
  100% {
    transform: scale(1);
  }
}

.btn:active,
.btn.is-pressed {
  filter: brightness(0.92);
}

.btn.is-pressing {
  animation: ui-press 0.28s ease;
}

.btn--print {
  flex: 0 0 auto;
  background: #ffffff;
  border: 0.5px solid #bbbbbb;
  font-weight: 500;
  color: #1b1b1b;
}

.btn--book {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--envelope-blue); /* #008EEB */
  border: 0;
  font-weight: 500;
  color: #ffffff;
  white-space: nowrap;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== Desktop / laptop breakpoints ========== */

/*
  1200–1679: Frame 77 в одну строку.
  Высота текста = высоте конверта; gap ≥ 128; шрифты полные (не ужимаем заранее).
  Ширина колонки текста может сжаться через flex, не через font-size.
*/
/* desktop open: панель ниже gift не должна пропадать на низком окне / после DevTools */
@media (min-width: 1200px) {
  .app:has(.envelope.is-open) {
    overflow-x: hidden;
    overflow-y: auto;
  }
}

@media (min-width: 1200px) and (max-width: 1679.98px) {
  .app {
    --page-pad-x: 48px;
    --page-gap: 128px;
    --content-stack-gap: 100px;
    --gift-max: 460px;
    --content-max: 711px;
    --ui-title: 40px;
    --ui-title-lh: 44px;
    --ui-sub: 20px;
    --ui-sub-lh: 24px;
    --ui-input: 40px;
    --ui-input-lh: 55px;
  }

  .site-main {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--page-gap);
  }

  .content-col {
    flex: 1 1 auto;
    min-width: 280px;
    max-width: min(var(--content-max), 100%);
    height: calc(var(--gift-w) * var(--body-h) / var(--design-w));
    max-height: calc(var(--gift-w) * var(--body-h) / var(--design-w));
    justify-content: space-between;
    gap: 0;
  }

  .gift-area {
    flex: 0 0 var(--gift-w);
  }
}

@media (min-width: 1280px) and (max-width: 1679.98px) {
  .app {
    --page-pad-x: 56px;
  }
}

@media (min-width: 1366px) and (max-width: 1679.98px) {
  .app {
    --page-pad-x: 64px;
  }
}

/*
  ≥1680 (Full HD): тот же layout, что у ноутбука —
  (intro+форма) слева | конверт справа. Пропорции FHD.
*/
@media (min-width: 1680px) {
  .app {
    --page-pad-x: 160px;
    --page-gap: 40px;
    --content-stack-gap: 100px;
    --gift-max: 460px;
    --gift-w: 460px;
    --content-max: 711px;
    --ui-title: 40px;
    --ui-title-lh: 44px;
    --ui-sub: 20px;
    --ui-sub-lh: 24px;
    --ui-input: 40px;
    --ui-input-lh: 55px;
  }

  .site-main {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: var(--page-gap);
  }

  .content-col {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 280px;
    max-width: min(var(--content-max), 100%);
    height: calc(var(--gift-w) * var(--body-h) / var(--design-w));
    max-height: calc(var(--gift-w) * var(--body-h) / var(--design-w));
    justify-content: space-between;
    gap: 0;
  }

  .intro,
  .card-entry {
    order: unset;
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    align-self: stretch;
  }

  .gift-area {
    order: unset;
    flex: 0 0 var(--gift-w);
    width: var(--gift-w);
    margin: 0;
  }
}

/* 1920×1080 — ближе друг к другу, шире боковые поля */
@media (min-width: 1920px) {
  .app {
    --page-pad-x: 220px;
    --page-max-w: 1920px;
    --page-gap: 40px;
    --content-max: 711px;
  }
}

/*
  2560×1440 — пропорционально ×4/3 от Full HD,
  layout как у ноутбука (слева текст+поле, справа конверт).
*/
@media (min-width: 2560px) and (min-height: 1200px) {
  .app {
    --page-pad-x: 293px; /* 220 × 4/3 */
    --page-max-w: 2560px;
    --page-gap: 53px; /* 40 × 4/3 */
    --content-stack-gap: 133px;
    --content-max: 948px; /* 711 × 4/3 */
    --gift-max: 613px; /* 460 × 4/3 */
    --gift-w: 613px;
    --ui-title: 53px; /* 40 × 4/3 */
    --ui-title-lh: 59px; /* 44 × 4/3 */
    --ui-sub: 27px; /* 20 × 4/3 */
    --ui-sub-lh: 32px; /* 24 × 4/3 */
    --form-row-h: 80px; /* 60 × 4/3 */
    --ui-input: calc(var(--form-row-h) * 40 / 60);
    --ui-input-lh: calc(var(--form-row-h) * 55 / 60);
    --ui-input-pad-top: calc(var(--form-row-h) * 20 / 60);
    --ui-error: 21px;
    --ui-error-lh: 29px;
    --envelope-radius: 43px;
  }

  .content-col {
    max-width: min(var(--content-max), 100%);
    height: calc(var(--gift-w) * var(--body-h) / var(--design-w));
    max-height: calc(var(--gift-w) * var(--body-h) / var(--design-w));
  }

  .gift-area {
    flex: 0 0 var(--gift-w);
    width: var(--gift-w);
  }

  .card-form__row,
  .card-form__field,
  .card-form__input,
  .card-form__submit,
  .card-form__icons {
    height: var(--form-row-h);
  }

  .card-form__submit {
    min-width: 80px; /* 60 × 4/3 */
  }

  .card-form__icons img {
    flex: 0 0 80px;
    width: 80px;
    height: 80px;
    max-width: 80px;
    max-height: 80px;
  }
}

/*
  PC adaptive < Full HD / 2K: ровные отступы текстовой панели.
  Боковые — как в базе (cqw 24/460), верх/низ — 20. Full HD+ не трогаем.
*/
@media (min-width: 1200px) and (max-width: 1919.98px) {
  .cert,
  .panel-flat .cert,
  .flap--bottom .cert {
    --cert-pad-x: max(14px, calc(5.217cqw * var(--cert-fit)));
    --cert-pad-y: 20px;
    padding: var(--cert-pad-y) var(--cert-pad-x);
    gap: 0;
  }
}

/*
  Высота ≤900/800/700 (только desktop ≥1200): ужимаем конверт + текст панели.
  Padding панели — общий блок выше (не перебиваем разными 18/14/12).
  Иначе max()-полы cqw не влезают → syncCertFit растит панель после анимации (скачок).
*/
@media (max-height: 900px) and (min-width: 1200px) {
  .app {
    --gift-max: 400px;
    --gift-w: min(
      400px,
      calc((100vh - 72px) * var(--design-w) / var(--design-h)),
      calc((100dvh - 72px) * var(--design-w) / var(--design-h))
    );
    --content-stack-gap: 56px;
  }

  .site-header {
    padding-top: 20px;
  }

  .gift-area {
    flex: 0 0 var(--gift-w);
    width: var(--gift-w);
  }

  .cert {
    gap: 0;
  }

  .cert__top {
    gap: 10px;
  }

  .cert__title {
    font-size: 22px;
    line-height: 30px;
  }

  .cert__service {
    font-size: 14px;
    line-height: 19px;
  }

  .cert__balance {
    font-size: 17px;
    line-height: 23px;
  }

  .cert__number,
  .cert__dates {
    font-size: 16px;
    line-height: 22px;
  }

  .cert__bottom,
  .cert__actions,
  .cert__meta {
    gap: 10px;
  }

  .btn {
    padding: 8px 16px;
    gap: 6px;
    font-size: 13px;
    line-height: 18px;
  }
}

@media (max-height: 800px) and (min-width: 1200px) {
  .app {
    --gift-max: 360px;
    --gift-w: min(
      360px,
      calc((100vh - 64px) * var(--design-w) / var(--design-h)),
      calc((100dvh - 64px) * var(--design-w) / var(--design-h))
    );
    --content-stack-gap: 40px;
    --ui-title: 34px;
    --ui-title-lh: 38px;
    --ui-sub: 17px;
    --ui-sub-lh: 22px;
    --ui-input: 34px;
    --ui-input-lh: calc(60px * 55 / 60);
    --ui-input-pad-top: calc(60px * 20 / 60);
  }

  .gift-area {
    flex: 0 0 var(--gift-w);
    width: var(--gift-w);
  }

  .cert {
    gap: 0;
  }

  .cert__top {
    gap: 8px;
  }

  .cert__title {
    font-size: 20px;
    line-height: 26px;
  }

  .cert__service {
    font-size: 13px;
    line-height: 18px;
  }

  .cert__balance {
    font-size: 15px;
    line-height: 20px;
  }

  .cert__number,
  .cert__dates {
    font-size: 14px;
    line-height: 18px;
  }

  .cert__bottom,
  .cert__actions,
  .cert__meta {
    gap: 8px;
  }

  .btn {
    padding: 7px 12px;
    gap: 6px;
    font-size: 12px;
    line-height: 16px;
  }
}

@media (max-height: 700px) and (min-width: 1200px) {
  .app {
    --gift-max: 320px;
    --gift-w: min(
      320px,
      calc((100vh - 56px) * var(--design-w) / var(--design-h)),
      calc((100dvh - 56px) * var(--design-w) / var(--design-h))
    );
    --content-stack-gap: 28px;
    --ui-title: 30px;
    --ui-title-lh: 34px;
    --ui-sub: 15px;
    --ui-sub-lh: 20px;
    --ui-input: 30px;
    --ui-input-lh: calc(60px * 55 / 60);
    --ui-input-pad-top: calc(60px * 20 / 60);
  }

  .gift-area {
    flex: 0 0 var(--gift-w);
    width: var(--gift-w);
  }

  .logo {
    width: 160px;
  }

  .cert {
    gap: 0;
  }

  .cert__top {
    gap: 6px;
  }

  .cert__title {
    font-size: 18px;
    line-height: 24px;
  }

  .cert__service {
    font-size: 12px;
    line-height: 16px;
  }

  .cert__balance {
    font-size: 14px;
    line-height: 18px;
  }

  .cert__number,
  .cert__dates {
    font-size: 13px;
    line-height: 17px;
  }

  .cert__bottom,
  .cert__actions,
  .cert__meta {
    gap: 6px;
  }

  .btn {
    padding: 6px 10px;
    gap: 4px;
    font-size: 12px;
    line-height: 16px;
  }
}

/* Стрелка свернуть — у правого верхнего угла сцены (клапан), без сдвига gift-area */
.collapse-btn {
  display: none;
  position: absolute;
  /* % от ширины gift-area (= --gift-w), зона верхнего клапана */
  top: calc(-100% * var(--fold-top) / var(--body-h) + 10px);
  right: 6px;
  z-index: 40;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
}

.collapse-btn:hover {
  opacity: 0.7;
}

.collapse-btn:active,
.collapse-btn.is-pressed {
  opacity: 0.55;
}

.collapse-btn.is-pressing .collapse-btn__icon,
.collapse-btn.is-pressing .collapse-btn__label {
  animation: ui-press 0.28s ease;
}

.collapse-btn__label {
  display: none;
  font-family: "Manrope", sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  color: #1b1b1b;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  transform-origin: center center;
  transition: transform 0.15s ease;
}

.collapse-btn__icon {
  display: block;
  width: 36px;
  height: 36px;
  overflow: visible;
  pointer-events: none;
  transform-origin: center center;
  transition: transform 0.15s ease;
}

.collapse-btn[hidden] {
  display: none !important;
}

/*
  ========== ≤1199: общее ==========
  3D как на десктопе; клики только по панели/кнопкам.
*/
@media (max-width: 1199.98px) {
  html,
  body {
    overflow-x: hidden;
    max-width: 100%;
  }

  .app {
    overflow-x: hidden;
    max-width: 100%;
  }

  .stage,
  .scene,
  .envelope {
    pointer-events: none;
  }

  /* целый top сцены — % от gift-h иначе дробный и мылит SVG карты */
  .stage {
    top: round(nearest, calc(-100% * var(--fold-top) / var(--body-h)), 1px);
  }

  .panel-flat,
  .panel-flat .cert,
  .panel-flat .btn,
  .panel-flat .cert__service-info,
  .collapse-btn {
    pointer-events: auto;
  }

  /*
    Карта остаётся в .envelope (без reparent) — иначе на open/close моргает.
    envelope flat: клапаны крутятся в своём 3D, карта не в общем preserve-3d → без мыла.
  */
  .envelope {
    -webkit-transform-style: flat;
    transform-style: flat;
  }

  .envelope .flap {
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
  }

  .envelope .card,
  .envelope .holders {
    -webkit-transform-style: flat;
    transform-style: flat;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: auto;
  }

  .envelope .card {
    /* без translateZ — на iOS он мылит соседние SVG (клапан/держатели) */
    -webkit-transform: scale(0.985);
    transform: scale(0.985);
  }

  .envelope.is-open .card {
    -webkit-transform: scale(1);
    transform: scale(1);
  }

  /* close: карта сразу под клапанами (без «долгого» показа поверх) */
  .envelope:not(.is-open).is-busy .card {
    -webkit-transform: scale(0.985);
    transform: scale(0.985);
    transition-duration: 0.2s;
    transition-delay: 0s;
  }

  .envelope.is-settled .flap {
    will-change: auto;
  }

  /* Figma PNG на сцене; rotateX клапана не трогаем */
  .envelope.is-settled .flap--top .flap__face img,
  .envelope.is-settled .holders img {
    image-rendering: auto;
  }

  .app:has(.envelope.is-settled) .stage {
    isolation: auto;
    transform: none;
  }

  .envelope.is-settled {
    -webkit-perspective: none;
    perspective: none;
    -webkit-transform-style: flat;
    transform-style: flat;
  }

  /* клапаны снова в своём 3D после settle envelope flat */
  .envelope.is-settled .flap {
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
  }

  /* на случай старого is-flat в DOM — не ломаем layout */
  .scene__scaler > .card.is-flat,
  .scene__scaler > .holders.is-flat {
    transform: none;
    filter: none;
    will-change: auto;
    -webkit-transform-style: flat;
    transform-style: flat;
  }
}

/*
  Планшет 641–1199: та же схема, что телефон (ниже), масштабом --s.
  Отдельный breakpoint убран — иначе !important прятал collapse и ломал chrome.
*/

/*
  ========== Compact ≤1199 (телефон + планшет) ==========
  Телефонная схема, на планшете масштабом --s.
  Success: intro+форма уезжают; выход — стрелка свернуть.
*/
@media (max-width: 1199.98px), (orientation: landscape) and (max-height: 500px) and (max-width: 999.98px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app {
    /* эталон 390×844; на планшете s>1 до ~1.55 */
    --s: min(calc(100vw / 390px), calc(100dvh / 844px), 1.55);
    --page-pad-x: calc(16px * var(--s));
    --gap: max(16px, calc(20px * var(--s)));
    --page-gap: var(--gap);
    --content-max: none;
    --ui-title: calc(26px * var(--s));
    --ui-title-lh: calc(30px * var(--s));
    --ui-sub: calc(14px * var(--s));
    --ui-sub-lh: calc(18px * var(--s));
    --form-row-h: calc(52px * var(--s));
    --ui-input: calc(var(--form-row-h) * 40 / 60);
    --ui-input-lh: calc(var(--form-row-h) * 55 / 60);
    --ui-input-pad-top: calc(var(--form-row-h) * 20 / 60);
    /* 8px при row 52 — эталон; планшет считает от того же отношения */
    --form-rule-gap: calc(var(--form-row-h) * 8 / 52);
    --ui-error: calc(13px * var(--s));
    --ui-error-lh: calc(18px * var(--s));
    --header-pad-top: 0px;
    /* сверху intro; снизу у input запас + safe-area + строка ошибки */
    --main-pad-top: 40px;
    --main-pad-bottom: max(
      40px,
      calc(40px + env(safe-area-inset-bottom, 0px)),
      calc(16px + var(--ui-error-lh) + 8px)
    );
    --chrome-dur: 0.5s;
    --chrome-ease: cubic-bezier(0.4, 0, 0.2, 1);
    /* высота иллюстрации над intro — в хроне, чтобы конверт влезал в 100dvh */
    --intro-gift-h: min(80px, 21vw);
    /*
      Хром стартового экрана (подарок+intro+форма+отступы+gap).
      Конверт ужимается, чтобы всё влезло в 100dvh без скролла.
    */
    --entry-chrome: calc(
      var(--main-pad-top) + var(--main-pad-bottom) +
        var(--gap) * 2 + var(--intro-gift-h) + 10px +
        var(--ui-title-lh) + var(--ui-sub-lh) + 8px +
        var(--form-row-h) + 16px + 30px
    );
    /* round как desktop 460px — дробный gift-w мылит SVG карты */
    --gift-w: round(
      nearest,
      min(
        calc(320px * var(--s)),
        calc(100vw - var(--page-pad-x) * 2),
        calc((100dvh - var(--entry-chrome)) * var(--design-w) / var(--body-h))
      ),
      1px
    );
    --gift-h: calc(var(--gift-w) * var(--body-h) / var(--design-w));
    --open-panel-h: calc(var(--gift-w) * var(--bottom-flap-h) / var(--design-w));
    /* 32/460 от ширины конверта — иначе на 320px радиус 32px съедает нижний padding */
    --envelope-radius: round(nearest, calc(var(--gift-w) * 32 / 460), 1px);
    height: 100dvh;
    max-height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
    background: #fff;
  }

  /* стабильный viewport — без мигания при снятии :has(success) */
  html,
  body {
    overflow: hidden;
    height: 100%;
    max-height: 100dvh;
  }

  /*
    Кадр после success→entry: layout уже entry, всё ещё невидимо.
    Потом снимаем класс — хром/конверт fade-in без вспышки max-height.
  */
  .app.is-chrome-boot .site-header,
  .app.is-chrome-boot .intro,
  .app.is-chrome-boot .card-entry,
  .app.is-chrome-boot .gift-area {
    opacity: 0 !important;
    transition: none !important;
  }

  /*
    После «свернуть»: intro+форма уже в layout (место занято — без дёрганья),
    но opacity:0. Показываем оба одновременно fade-in.
  */
  .app.is-chrome-hold .intro,
  .app.is-chrome-hold .card-entry {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: none !important;
  }

  .app.is-chrome-fading .intro,
  .app.is-chrome-fading .card-entry {
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--chrome-dur) var(--chrome-ease);
  }

  .site-header {
    position: relative;
    left: auto;
    transform: none;
    max-width: none;
    flex: 0 0 auto;
    padding: var(--header-pad-top) var(--page-pad-x) 0;
    /* только opacity: max-height в transition сдвигает конверт к верху во время выезда */
    transition: opacity var(--chrome-dur) var(--chrome-ease);
    max-height: 80px;
    overflow: hidden;
  }

  .logo {
    width: var(--logo-w);
    height: auto;
  }

  .site-main {
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: var(--gap);
    min-height: 0;
    padding: var(--main-pad-top) var(--page-pad-x) var(--main-pad-bottom);
    overflow: hidden;
  }

  /*
    Canvas выше и длиннее сцены: частицы улетают за экран,
    не оседают кучей у низа конверта.
  */
  .confetti-canvas {
    top: -35%;
    height: 220%;
  }

  .gift-area,
  .stage {
    overflow: visible;
  }

  .content-col {
    display: contents;
  }

  .intro {
    order: 1;
    flex: 0 0 auto;
    flex-direction: column;
    align-self: stretch;
    align-items: center;
    width: 100%;
    gap: 10px;
    margin-top: 30px;
    z-index: 5;
    overflow: hidden;
    max-height: calc(var(--intro-gift-h) + 10px + var(--ui-title-lh) + 8px + var(--ui-sub-lh) + 8px);
    opacity: 1;
    transition: opacity var(--chrome-dur) var(--chrome-ease);
    text-align: center;
  }

  .intro__copy {
    align-items: center;
    order: 2;
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    gap: calc(6px * var(--s));
  }

  .intro__gift {
    order: 1;
    height: var(--intro-gift-h);
    width: auto;
    max-width: min(30vw, 100px);
    max-height: var(--intro-gift-h);
  }

  .intro__gift img {
    width: auto;
    height: 100%;
    max-width: 100%;
    max-height: var(--intro-gift-h);
    object-fit: contain;
    object-position: center;
  }

  .intro__title {
    font-weight: 500;
    font-size: var(--ui-title);
    line-height: var(--ui-title-lh);
    text-align: center;
  }

  .intro__text {
    font-weight: 300;
    font-size: var(--ui-sub);
    line-height: var(--ui-sub-lh);
    text-align: center;
  }

  /* старт: конверт по центру между intro и формой */
  .gift-area {
    order: 2;
    flex: 0 0 auto;
    width: var(--gift-w);
    min-width: 0;
    max-width: 100%;
    height: var(--gift-h);
    margin-top: auto;
    margin-bottom: auto;
    margin-left: auto;
    margin-right: auto;
    z-index: 2;
    /* без isolation — на мобилке иначе карта/стрелка в мыльном слое */
    isolation: auto;
  }

  .stage {
    z-index: 2;
    /* translateZ(0)+isolation на мобилке размывают SVG карты и стрелку */
    isolation: auto;
    transform: none;
  }

  .card {
    will-change: auto;
  }

  .collapse-btn {
    transform: none !important;
  }

  .collapse-btn__icon {
    transform: none;
    image-rendering: -webkit-optimize-contrast;
  }

  .card-entry {
    order: 3;
    flex: 0 0 auto;
    align-self: center;
    width: var(--gift-w);
    max-width: 100%;
    z-index: 5;
    /* visible — текст ошибки в зоне main-pad-bottom */
    overflow: visible;
    max-height: none;
    opacity: 1;
    transition: opacity var(--chrome-dur) var(--chrome-ease);
  }

  .card-form__error {
    z-index: 6;
    top: calc(100% + var(--form-rule-gap));
  }

  .card-form {
    gap: var(--form-rule-gap);
  }

  .card-form,
  .card-form__row,
  .card-form__field,
  .card-form__input,
  .card-form__rule {
    width: 100%;
    max-width: none;
  }

  .card-form__row {
    height: var(--form-row-h);
    gap: calc(12px * var(--s));
    align-items: flex-start;
  }

  .card-form__field,
  .card-form__input,
  .card-form__submit,
  .card-form__icons {
    height: var(--form-row-h);
  }

  .card-form__input {
    padding: var(--ui-input-pad-top) 0 0;
    font-size: calc(28px * var(--s));
    line-height: var(--ui-input-lh);
  }

  .card-form__submit {
    min-width: calc(48px * var(--s));
  }

  .card-form__icons img {
    flex: 0 0 calc(48px * var(--s));
    width: calc(48px * var(--s));
    height: calc(48px * var(--s));
    max-width: calc(48px * var(--s));
    max-height: calc(48px * var(--s));
  }

  .card-form__error {
    font-size: var(--ui-error);
    line-height: var(--ui-error-lh);
  }

  /*
    Сертификат на мобилке: боковые как были, верх/низ по 20.
    Высота = контент (без min-height/space-between) — без пустоты после кнопок.
  */
  .panel-flat .bottom-back {
    display: flex;
    flex-direction: column;
    aspect-ratio: auto;
    min-height: 0;
    height: auto;
    overflow: hidden;
  }

  .flap--bottom .bottom-back.is-tall {
    min-height: 0;
  }

  .cert,
  .panel-flat .cert,
  .flap--bottom .cert {
    --cert-fit: 1;
    --cert-pad-x: max(12px, calc(14px * var(--s)));
    --cert-pad-y: 20px;
    --cert-gap-min: 20px;
    justify-content: flex-start;
    padding: var(--cert-pad-y) var(--cert-pad-x);
    gap: 0;
  }

  .panel-flat .bottom-back.is-tall .cert,
  .flap--bottom .bottom-back.is-tall .cert {
    justify-content: flex-start;
  }

  /* fill высоты панели — не height:auto, иначе снизу дыра */
  .panel-flat .cert {
    position: absolute;
    inset: 0;
    flex: none;
    width: auto;
    height: auto;
    min-height: 0;
    overflow: hidden;
  }

  .cert__top {
    gap: calc(8px * var(--s));
  }

  .cert__title {
    font-size: max(14px, calc(18px * var(--s)));
    line-height: max(18px, calc(24px * var(--s)));
  }

  .cert__service {
    /* пол 14px; на compact услуга целиком, без обрезки в 4 строки */
    display: block;
    font-size: max(14px, calc(13px * var(--s)));
    line-height: max(18px, calc(17px * var(--s)));
    -webkit-line-clamp: unset;
    overflow: visible;
  }

  @media (max-width: 640.98px) {
    .cert__title {
      font-size: 18px;
      line-height: 24px;
    }
  }

  .cert__balance {
    font-size: max(14px, calc(15px * var(--s)));
    line-height: max(18px, calc(20px * var(--s)));
  }

  .cert__number,
  .cert__dates {
    font-size: max(14px, calc(14px * var(--s)));
    line-height: max(18px, calc(18px * var(--s)));
  }

  .cert__bottom,
  .cert__actions {
    gap: calc(8px * var(--s));
  }

  .cert__meta {
    gap: calc(10px * var(--s));
  }

  .btn {
    padding: calc(7px * var(--s)) max(4px, calc(7px * var(--s)));
    gap: calc(6px * var(--s));
    border-radius: calc(6px * var(--s));
    font-size: max(14px, calc(12px * var(--s)));
    line-height: max(18px, calc(16px * var(--s)));
    white-space: nowrap;
  }

  .btn--print {
    padding-inline: calc(4px + max(4px, 7px * var(--s)));
  }

  .btn--book {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .card__nominal-amount,
  .card__number {
    font-size: max(14px, calc(14px * var(--s)));
  }

  /*
    Правый верх открытого верхнего клапана (не на корпусе).
    Клапан вверх ≈ 100% gift-h; кнопка на его лицевой зоне у правого края.
  */
  .collapse-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
    top: calc(-100% + 14px);
    bottom: auto;
    right: 10px;
    width: auto;
    height: auto;
    padding: 2px 4px;
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s ease;
  }

  .collapse-btn__label {
    display: block;
    font-size: calc(12px * var(--s));
    line-height: 1.2;
    color: #ffffff;
  }

  .collapse-btn__icon {
    display: block;
    width: calc(40px * var(--s));
    height: calc(46px * var(--s));
    flex-shrink: 0;
  }

  .collapse-btn__icon path {
    stroke: #ffffff;
    stroke-width: 1.5;
  }

  .collapse-btn[hidden] {
    display: none !important;
  }

  .collapse-btn.is-visible:not([hidden]) {
    opacity: 1;
    pointer-events: auto;
  }

  /* :active / :hover / .is-pressed иначе оставляют ~0.55–0.7 и «свернуть» не гаснет */
  .collapse-btn.is-hiding,
  .collapse-btn.is-hiding:hover,
  .collapse-btn.is-hiding:active,
  .collapse-btn.is-hiding.is-pressed {
    opacity: 0 !important;
    pointer-events: none !important;
  }

  /*
    Success: chrome уезжает; конверт + стрелка прижаты вниз (как изначально).
    Без скролла: gift масштабируется под body+панель.
  */
  .app[data-state="success"] {
    height: 100dvh;
    max-height: 100dvh;
    overflow-x: hidden;
    overflow-y: hidden;
    /* 20 top + 20 bottom + запас под панель; стрелка внутри конверта */
    --gift-w: round(
      nearest,
      min(
        calc(360px * var(--s)),
        calc(100vw - 32px),
        calc(
          (100dvh - 48px) * var(--design-w) /
            (var(--body-h) + var(--bottom-flap-h))
        )
      ),
      1px
    );
    --gift-h: calc(var(--gift-w) * var(--body-h) / var(--design-w));
    --open-panel-h: calc(var(--gift-w) * var(--bottom-flap-h) / var(--design-w));
    --envelope-radius: round(nearest, calc(var(--gift-w) * 32 / 460), 1px);
  }

  /* длинный сертификат — страница скроллится, панель не режем */
  .app[data-state="success"].is-cert-overflow {
    height: auto;
    max-height: none;
    min-height: 100dvh;
    overflow: visible;
  }

  html:has(.app[data-state="success"].is-cert-overflow),
  body:has(.app[data-state="success"].is-cert-overflow) {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    max-height: none;
    -webkit-overflow-scrolling: touch;
  }

  .app[data-state="success"].is-cert-overflow .site-main {
    overflow: visible;
    flex: 0 0 auto;
    height: auto;
    max-height: none;
  }

  html:has(.app[data-state="success"]),
  body:has(.app[data-state="success"]) {
    overflow: hidden;
    height: 100%;
    max-height: 100dvh;
  }

  .app[data-state="success"] .site-header {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin: 0;
    pointer-events: none;
  }

  .app[data-state="success"] .site-main {
    justify-content: flex-start;
    gap: 0;
    padding-top: 20px;
    padding-bottom: 20px;
    overflow: hidden;
    min-height: 0;
    /* perspective только на время Z (.is-mobile-z) — иначе карта мылится */
    -webkit-perspective: none;
    perspective: none;
  }

  .app.is-mobile-z[data-state="success"] .site-main {
    -webkit-perspective: 1400px;
    perspective: 1400px;
    -webkit-perspective-origin: 50% 45%;
    perspective-origin: 50% 45%;
  }

  /* после Z снимаем композитный слой с gift — резкая карта/клапаны */
  .app[data-state="success"]:not(.is-mobile-z) .gift-area {
    transform: none;
  }

  .app[data-state="success"] .intro {
    opacity: 0;
    max-height: 0;
    margin: 0;
    padding: 0;
    gap: 0;
    pointer-events: none;
  }

  .app[data-state="success"] .intro__gift {
    max-height: 0;
    height: 0;
    overflow: hidden;
  }

  .app[data-state="success"] .card-entry {
    opacity: 0;
    max-height: 0;
    margin: 0;
    overflow: hidden;
    pointer-events: none;
  }

  .app[data-state="success"] .gift-area {
    width: var(--gift-w);
    max-width: 100%;
    height: var(--gift-h);
    /* прижат вниз, снизу запас под открытую панель + отступ 20px у main */
    margin-top: auto;
    margin-bottom: var(--open-panel-h);
    margin-left: auto;
    margin-right: auto;
    flex: 0 0 auto;
    overflow: visible;
    -webkit-transform-style: flat;
    transform-style: flat;
    /* backface-visibility на gift мылит детей (карта, стрелка) — не ставим */
  }
}

/*
  Телефон: ширина конверта = строка «Имеются противопоказания…».
  Замер Manrope 300: 326px при кегле 10px. Тот же clamp, что у дисклеймера.
*/
@media (max-width: 640.98px) {
  .app {
    --gift-w: round(
      nearest,
      min(
        calc(326px * clamp(8px, 2.55vw, 10px) / 10px),
        calc((100dvh - var(--entry-chrome)) * var(--design-w) / var(--body-h))
      ),
      1px
    );
  }

  .app[data-state="success"] {
    --gift-w: round(
      nearest,
      calc(326px * clamp(8px, 2.55vw, 10px) / 10px),
      1px
    );
  }
}

/* SE: не даём браузеру сдвигать конверт якорём прокрутки */
@media (max-width: 389.98px) and (max-height: 700px) {
  .site-main {
    overflow-anchor: none;
  }
}

/*
  Только телефон/маленький планшет в landscape (класс с JS).
  Не трогаем desktop/ноутбук ≥1200 — иначе ломается PC-адаптив.
*/
html.is-touch-landscape,
html.is-touch-landscape body {
  height: auto !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

html.is-touch-landscape .app {
  height: auto !important;
  max-height: none !important;
  min-height: 100dvh !important;
  overflow-x: hidden !important;
  overflow-y: visible !important;
  --s: min(1, calc(100vw / 844px), calc(100dvh / 390px)) !important;
  /* те же отступы, что в portrait compact — не сжимать intro ↔ конверт ↔ input */
  --page-pad-x: calc(16px * var(--s)) !important;
  --gap: max(16px, calc(20px * var(--s))) !important;
  --page-gap: var(--gap) !important;
  --main-pad-top: 40px !important;
  --main-pad-bottom: max(
    40px,
    calc(40px + env(safe-area-inset-bottom, 0px)),
    calc(16px + var(--ui-error-lh) + 8px)
  ) !important;
  --gift-w: round(
    nearest,
    min(
      300px,
      calc(100vw - var(--page-pad-x) * 2),
      calc((100dvh - 130px) * var(--design-w) / var(--body-h))
    ),
    1px
  ) !important;
  --gift-h: calc(var(--gift-w) * var(--body-h) / var(--design-w)) !important;
  --open-panel-h: calc(
    var(--gift-w) * var(--bottom-flap-h) / var(--design-w)
  ) !important;
}

html.is-touch-landscape .app[data-state="success"] {
  height: auto !important;
  max-height: none !important;
  overflow-y: visible !important;
}

html.is-touch-landscape .site-header {
  position: relative !important;
  left: auto !important;
  transform: none !important;
}

html.is-touch-landscape .site-main {
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: var(--gap) !important;
  overflow: visible !important;
  min-height: 0 !important;
  padding: var(--main-pad-top) var(--page-pad-x) var(--main-pad-bottom) !important;
}

html.is-touch-landscape .content-col {
  display: contents !important;
  height: auto !important;
  max-height: none !important;
}

html.is-touch-landscape .intro {
  order: 1 !important;
  flex: 0 0 auto !important;
  flex-direction: column !important;
  align-self: stretch !important;
  align-items: center !important;
  width: 100% !important;
  max-width: none !important;
  text-align: center !important;
  max-height: none !important;
}

html.is-touch-landscape .intro__copy {
  align-items: center !important;
  order: 2 !important;
  width: 100% !important;
}

html.is-touch-landscape .intro__gift {
  order: 1 !important;
  height: min(88px, 28vw) !important;
  max-height: min(88px, 28vw) !important;
  max-width: min(120px, 36vw) !important;
}

html.is-touch-landscape .intro__title,
html.is-touch-landscape .intro__text {
  text-align: center !important;
}

html.is-touch-landscape .gift-area {
  order: 2 !important;
  flex: 0 0 auto !important;
  width: var(--gift-w) !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: var(--gift-h) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

html.is-touch-landscape .card-entry {
  order: 3 !important;
  flex: 0 0 auto !important;
  align-self: center !important;
  width: var(--gift-w) !important;
  max-width: 100% !important;
}

@media (max-width: 400px) {
  .card-form__input {
    padding: 12px 0 0;
    font-size: 24px;
    line-height: var(--ui-input-lh);
  }

  /* боковые как были, верх/низ 20 — не даём радиусу съесть низ */
  .cert,
  .panel-flat .cert,
  .flap--bottom .cert {
    --cert-pad-x: 14px;
    --cert-pad-y: 20px;
    --cert-gap-min: 20px;
    padding: var(--cert-pad-y) var(--cert-pad-x);
    gap: 0;
  }
}

/*
  <360 (320×568 и уже): «свернуть» + стрелка пропорционально уже эталона 360.
  Старый override на 36×41 как раз раздувал кнопку относительно --s.
*/
@media (max-width: 359.98px) {
  .collapse-btn {
    right: 6px;
    gap: 1px;
    padding: 1px 2px;
    top: calc(-100% + 10px);
  }

  .collapse-btn__label {
    /* 360→10px, 320→≈8.9px */
    font-size: calc(10px * 100vw / 360px);
    line-height: 1.15;
  }

  .collapse-btn__icon {
    /* 360→28×32, 320→≈25×28 */
    width: calc(28px * 100vw / 360px);
    height: calc(32px * 100vw / 360px);
  }

  .collapse-btn__icon path {
    stroke-width: 1.25;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --flap-top-duration: 0.01s;
    --flap-bottom-duration: 0.01s;
    --flap-bottom-delay-open: 0s;
    --flap-top-delay-close: 0s;
    --card-duration: 0.01s;
    --card-delay-open: 0s;
  }

  .app {
    --chrome-dur: 0.01s;
  }

  .envelope:not(.is-open):not(.is-busy):hover .flap--top {
    transform: none;
  }

  .card-form__input::placeholder {
    transition: none;
  }

  .btn,
  .card-form__submit,
  .collapse-btn__icon,
  .collapse-btn__label {
    transition: none;
  }

  .btn:active,
  .btn.is-pressed,
  .btn.is-pressing,
  .card-form__submit:active:not(:disabled),
  .card-form__submit.is-pressed:not(:disabled),
  .card-form__submit.is-pressing:not(:disabled),
  .collapse-btn:active,
  .collapse-btn.is-pressed,
  .collapse-btn.is-pressing .collapse-btn__icon,
  .collapse-btn.is-pressing .collapse-btn__label {
    filter: none;
    opacity: 1;
    transform: none;
    animation: none;
  }
}
