/* Эксперт Новострой — квиз-чат
   Токены: design-tokens.css (палитра с expert-novostroy.ru/contacts/)
   Дубли :root здесь только как fallback, если tokens не подключены. */

:root {
  /* fallback — полные значения в design-tokens.css */
  --en-dark: #202d3b;
  --en-deep: #5d8aa3;
  --en-blue: #5d8aa3;
  --en-blue-bright: #7aafca;
  --en-blue-light: #7aafca;
  --en-blue-pale: #edf7fb;
  --en-bg: #f4f4f4;
  --en-bg-brand: #f4f8fb;
  --en-h1: #2f3947;
  --en-heading: #303b49;
  --en-graphite: #424c5c;
  --en-lead: #536372;
  --en-body: #5d6c7c;
  --en-muted: #697786;
  --en-line: #dce8f0;
  --en-orange: #ffa828;
  --en-orange-hot: #ffb340;
  --en-icon-bg: #edf7fb;
  --en-grad: linear-gradient(135deg, #7aafca 0%, #5d8aa3 100%);
  --en-shadow: 0 22px 55px rgba(66, 76, 92, 0.13);
  --en-shadow-sm: 0 12px 30px rgba(66, 76, 92, 0.08);
  --en-navy: var(--en-dark);
  --en-navy-deep: #162029;
  --en-ink: var(--en-h1);
  --en-white: #fff;
  --en-border: var(--en-line);
  --en-font: "Montserrat", "Segoe UI", Arial, sans-serif;
  --en-radius: 24px;
  --en-panel-w: 880px;
  --en-bar: #2a3a4c;
  --en-text: 16px;
  --en-text-sm: 14px;
  --en-topbar-h: 56px;
  --en-gutter: 40px;
  --en-screen-gap: 22px;
  --en-edge-y: var(--en-screen-gap);
  --en-edge-y-bottom: var(--en-screen-gap);
  --en-stack-w: min(58vw, var(--en-panel-w));
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--en-font);
  color: var(--en-ink);
  background: var(--en-dark);
  touch-action: manipulation;
}

html.en-fit,
html.en-fit body {
  height: 100%;
  overflow: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--en-blue);
}

.en-page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: visible;
  padding-top: 0;
}

.en-page.en-fit {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.en-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(32, 45, 59, 0.42) 0%, rgba(32, 45, 59, 0.12) 42%, rgba(32, 45, 59, 0.5) 100%),
    url("../assets/bg-novostroy.jpg") center / cover no-repeat;
}

.en-chat-stack {
  position: relative;
  z-index: 1;
  width: var(--en-stack-w);
  max-width: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  flex: 0 1 auto;
  transition: width 0.25s ease;
}

.en-page.en-fit .en-chat-stack {
  /* main — flex-row: не растягивать по ширине, только по высоте */
  flex: 0 1 auto;
  align-self: stretch;
  width: var(--en-stack-w);
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: visible;
}

/* Лого + телефон: в потоке, уезжают при скролле */
.en-topbar {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  min-height: var(--en-topbar-h);
  padding: 0;
  background: var(--en-bar);
  color: var(--en-white);
  border-radius: var(--en-radius) var(--en-radius) 0 0;
  box-shadow: 0 8px 24px rgba(32, 45, 59, 0.18);
  overflow: hidden;
  flex: 0 0 auto;
}

.en-topbar-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  box-sizing: border-box;
}

/* Тонкая полоска: липнет к верху экрана при скролле */
.en-progress {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  height: 4px;
  margin: 0;
  border-radius: 0;
  background: var(--en-bar);
  overflow: hidden;
  flex: 0 0 auto;
}

.en-progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffb84a 0%, #ffa828 55%, #f59a16 100%);
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.en-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

.en-logo-mark {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.en-brand-text {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35em;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
}

.en-brand-expert {
  color: #c8d2dc;
}

.en-brand-novo {
  color: var(--en-blue-bright);
}

.en-phone {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  color: var(--en-white);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  flex: 0 0 auto;
  flex-shrink: 0;
  line-height: 1;
  padding: 6px 10px;
  margin: -6px -4px -6px 0;
  border-radius: 8px;
}

.en-phone::before {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 55%;
  height: 100%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(255, 255, 255, 0.1) 35%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(255, 255, 255, 0.1) 65%,
    transparent 100%
  );
  transform: skewX(-18deg);
  pointer-events: none;
  z-index: 1;
  animation: en-btn-shine 2.8s ease-in-out infinite;
}

.en-phone:hover {
  color: var(--en-blue-light);
}

@media (prefers-reduced-motion: reduce) {
  .en-phone::before {
    animation: none;
    opacity: 0;
  }
}

.en-main {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  /* верх: --en-edge-y (22px); низ: --en-edge-y-bottom (≥22px под политики) */
  padding: calc(var(--en-edge-y) + env(safe-area-inset-top, 0px))
    var(--en-gutter)
    calc(var(--en-edge-y-bottom) + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  transition: padding 0.25s ease;
}

.en-page.en-fit .en-main {
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
}

.en-main--thanks {
  flex: 1 1 auto;
  align-items: center;
  min-height: 0;
}

.en-panel {
  width: 100%;
  min-height: min(620px, calc(100dvh - 130px));
  height: auto;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--en-line);
  border-top: 0;
  border-radius: 0 0 var(--en-radius) var(--en-radius);
  box-shadow: var(--en-shadow);
  overflow: hidden;
}

.en-panel.is-sizing {
  transition: height 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: height;
}

@media (prefers-reduced-motion: reduce) {
  .en-panel.is-sizing {
    transition: none;
  }
}

.en-page.en-fit .en-panel {
  flex: 1 1 0;
  height: auto;
  max-height: none;
  min-height: 0;
}

.en-page.en-fit .en-panel-head {
  flex: 0 0 auto;
  min-height: auto;
}

.en-page.en-fit .en-benefits-rise.is-open {
  flex: 0 0 auto;
  min-height: min-content;
}

.en-page.en-fit .en-benefits-rise.is-open .en-benefits-rise-inner {
  min-height: min-content;
}

.en-panel-head {
  display: flex;
  flex-direction: column;
  padding: 0;
  border-bottom: 1px solid rgba(220, 232, 240, 0.75);
  background: rgba(244, 248, 251, 0.72);
  flex: 0 0 auto;
  overflow: hidden;
}

/* УТП: три светлые мини-карточки */
.en-benefits-rise {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transform: translateY(10px);
  background: transparent;
  transition:
    grid-template-rows 0.5s ease,
    opacity 0.4s ease,
    transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.en-benefits-rise.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
  transform: translateY(0);
}

.en-benefits-rise-inner {
  overflow: hidden;
  min-height: 0;
  padding: 14px 16px 16px;
}

.en-benefits-lead {
  margin: 0 auto 12px;
  max-width: 40em;
  font-size: clamp(14px, 2vw, 17px);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: var(--en-h1);
  text-align: center;
}

.en-benefits-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.en-benefit-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 12px;
  background: var(--en-white);
  border: 1px solid var(--en-line);
  border-radius: 20px;
  box-shadow: var(--en-shadow-sm);
  font-size: clamp(12px, 1.7vw, 13px);
  font-weight: 600;
  line-height: 1.35;
  color: var(--en-heading);
}

.en-benefits-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--en-icon-bg);
  border: 1px solid var(--en-line);
  color: var(--en-deep);
}

.en-benefits-icon svg {
  width: 20px;
  height: 20px;
}

.en-benefits-text {
  display: block;
  padding-top: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .en-benefits-rise {
    transition: none;
    transform: none;
  }

  .en-benefits-rise.is-open {
    transform: none;
  }
}

.en-feed {
  flex: 0 0 auto;
  padding: 18px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: transparent;
}

.en-page.en-fit .en-feed {
  /* сжимается, чтобы .en-cookie оставался в кадре на первом экране */
  flex: 0 1 auto;
  max-height: none;
  min-height: 0;
  overflow: visible;
  padding: 10px 14px 6px;
  gap: 8px;
}

.en-page.en-fit .en-dock {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.en-page.en-fit .en-cards {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.en-page.en-fit .en-card {
  min-height: 0;
}

.en-page.en-fit .en-card img {
  flex: 1 1 0;
  width: 100%;
  height: 0;
  min-height: clamp(72px, 11vh, 100px);
  max-height: none;
  aspect-ratio: auto;
  object-fit: cover;
}

.en-page.en-fit .en-card-label {
  flex: 0 0 auto;
  flex-shrink: 0;
  padding: 8px 10px 10px;
  font-size: clamp(12px, 1.9vh, 14px);
  line-height: 1.3;
  min-height: 2.6em;
}

/* Карточки не влезли даже после сжатия — скролл чат-панели (сообщения + карточки) */
.en-page.en-fit.en-fit-scroll .en-panel,
.en-page.en-fit.en-fit-measure .en-panel {
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.en-page.en-fit.en-fit-measure .en-panel {
  overflow-y: hidden;
}

.en-page.en-fit.en-fit-scroll .en-feed,
.en-page.en-fit.en-fit-measure .en-feed {
  flex: 0 0 auto;
}

.en-page.en-fit.en-fit-scroll .en-dock,
.en-page.en-fit.en-fit-measure .en-dock {
  flex: 0 0 auto;
  overflow: visible;
}

.en-page.en-fit.en-fit-scroll .en-cards,
.en-page.en-fit.en-fit-measure .en-cards {
  flex: 0 0 auto;
  height: auto;
  min-height: 0;
  grid-template-rows: auto auto;
}

.en-page.en-fit.en-fit-scroll .en-card,
.en-page.en-fit.en-fit-measure .en-card {
  min-height: 0;
}

.en-page.en-fit.en-fit-scroll .en-card img,
.en-page.en-fit.en-fit-measure .en-card img {
  flex: 0 0 auto;
  height: auto;
  width: 100%;
  min-height: 110px;
  max-height: 180px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.en-page.en-fit .en-bubble {
  font-size: clamp(14px, 2.1vh, 16px);
}

.en-page.en-fit .en-benefits-rise-inner {
  padding: 12px 14px 14px;
}

.en-page.en-fit .en-benefits-lead {
  margin-bottom: 10px;
  font-size: clamp(13px, 1.9vh, 16px);
}

.en-page.en-fit .en-benefit-card {
  font-size: clamp(11px, 1.6vh, 13px);
  padding: 10px;
}

.en-page.en-fit .en-benefits-icon {
  width: 34px;
  height: 34px;
}

.en-row {
  display: flex;
  gap: 10px;
  max-width: 100%;
  animation: enFade 0.25s ease;
}

.en-row--bot {
  align-self: flex-start;
  align-items: flex-end;
  max-width: 88%;
}

.en-row--user {
  align-self: flex-end;
  max-width: 72%;
}

.en-row-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.en-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: clamp(14px, 0.4rem + 1.1vw, 17px);
  line-height: 1.45;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.en-row--bot .en-bubble {
  background: var(--en-bg-brand);
  border: 1px solid var(--en-line);
  border-bottom-left-radius: 4px;
  color: var(--en-heading);
}

.en-row--user .en-bubble {
  background: var(--en-deep);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.en-bubble--choice {
  padding: 0;
  overflow: hidden;
  background: #fff !important;
  border: 1px solid var(--en-border);
  color: var(--en-ink);
  max-width: 260px;
}

.en-choice-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--en-blue-pale);
}

.en-choice-label {
  display: block;
  flex: 0 0 auto;
  padding: 10px 12px 12px;
  font-size: clamp(13px, 0.35rem + 1vw, 15px);
  font-weight: 700;
  line-height: 1.3;
  color: var(--en-ink);
  overflow-wrap: anywhere;
}

.en-typing {
  display: inline-flex;
  gap: 4px;
  padding: 4px 2px;
}

.en-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--en-blue);
  opacity: 0.35;
  animation: enDot 1s infinite ease-in-out;
}

.en-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.en-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

.en-type-cursor {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 2px;
  background: var(--en-blue);
  vertical-align: -0.15em;
  animation: enCursor 0.75s step-end infinite;
}

@keyframes enCursor {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .en-type-cursor {
    animation: none;
  }
}

.en-dock {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  padding: 12px 16px 12px;
  border-top: 1px solid rgba(220, 232, 240, 0.45);
  /* Карточки на фоне чата — без светлой «подложки» до появления картинок */
  background: transparent;
}

/* Форма: компактная зона под контент, без растягивания на всю высоту */
.en-dock:has(.en-form--phone) {
  background: rgba(255, 255, 255, 0.55);
  border-top: 1px solid rgba(220, 232, 240, 0.75);
  padding: 16px 18px 24px;
  flex: 0 0 auto;
  min-height: 0;
  align-items: center;
  justify-content: flex-start;
}

.en-page.en-fit .en-dock:has(.en-form--phone) {
  padding: 12px 14px 20px;
}

/* Форма после карточек: панель по контенту, вертикальные поля как у .en-main */
.en-page.en-even-gaps {
  min-height: 100dvh;
}

.en-page.en-even-gaps .en-main {
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
}

.en-cookie {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 12px 16px;
  background: var(--en-white);
  border-top: 1px solid var(--en-line);
  color: var(--en-body);
  font-size: 13px;
  line-height: 1.4;
}

.en-cookie.is-hidden,
.en-cookie.en-cookie-away {
  display: none;
}

.en-cookie-text {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 400;
  color: var(--en-body);
}

.en-cookie-more {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 600;
  color: var(--en-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.en-cookie-more:hover,
.en-cookie-more:focus-visible {
  color: var(--en-dark);
  outline: none;
}

.en-cookie-ok {
  appearance: none;
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 18px;
  border: 1px solid var(--en-line);
  border-radius: 15px;
  background: var(--en-white);
  color: var(--en-heading);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--en-shadow-sm);
}

.en-cookie-ok:hover,
.en-cookie-ok:focus-visible {
  border-color: var(--en-deep);
  color: var(--en-deep);
  outline: none;
}

.en-page.en-fit .en-cookie {
  flex: 0 0 auto;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  padding: 10px 14px;
  font-size: 12px;
  background: var(--en-white);
}

.en-page.en-fit .en-cookie-ok {
  min-height: 32px;
  padding: 0 14px;
  font-size: 12px;
}

.en-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.en-dock-in {
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.35s ease,
    transform 0.35s ease;
}

.en-dock-in.is-in {
  opacity: 1;
  transform: none;
}

.en-cards.en-dock-in .en-card,
.en-chips.en-dock-in .en-chip {
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.35s ease,
    transform 0.35s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.en-cards.en-dock-in.is-in .en-card,
.en-chips.en-dock-in.is-in .en-chip {
  opacity: 1;
  transform: none;
}

/* Волна по рядам: 1–2 вместе, затем 3–4 */
.en-cards.en-dock-in.is-in .en-card:nth-child(1),
.en-cards.en-dock-in.is-in .en-card:nth-child(2),
.en-chips.en-dock-in.is-in .en-chip:nth-child(1),
.en-chips.en-dock-in.is-in .en-chip:nth-child(2) {
  transition-delay: 0ms;
}

.en-cards.en-dock-in.is-in .en-card:nth-child(3),
.en-cards.en-dock-in.is-in .en-card:nth-child(4),
.en-chips.en-dock-in.is-in .en-chip:nth-child(3),
.en-chips.en-dock-in.is-in .en-chip:nth-child(4) {
  transition-delay: 110ms;
}

/* Даже при reduced-motion оставляем быстрый fade (как печать) */
@media (prefers-reduced-motion: reduce) {
  .en-dock-in {
    opacity: 0;
    transform: none;
    transition: opacity 0.28s ease;
  }

  .en-dock-in.is-in {
    opacity: 1;
  }

  .en-cards.en-dock-in .en-card,
  .en-chips.en-dock-in .en-chip {
    opacity: 0;
    transform: none;
    transition: opacity 0.28s ease;
  }

  .en-cards.en-dock-in.is-in .en-card,
  .en-chips.en-dock-in.is-in .en-chip {
    opacity: 1;
  }

  .en-cards.en-dock-in.is-in .en-card:nth-child(1),
  .en-cards.en-dock-in.is-in .en-card:nth-child(2),
  .en-chips.en-dock-in.is-in .en-chip:nth-child(1),
  .en-chips.en-dock-in.is-in .en-chip:nth-child(2) {
    transition-delay: 0ms;
  }

  .en-cards.en-dock-in.is-in .en-card:nth-child(3),
  .en-cards.en-dock-in.is-in .en-card:nth-child(4),
  .en-chips.en-dock-in.is-in .en-chip:nth-child(3),
  .en-chips.en-dock-in.is-in .en-chip:nth-child(4) {
    transition-delay: 90ms;
  }
}

.en-card {
  appearance: none;
  border: 1px solid var(--en-line);
  background: transparent;
  border-radius: 22px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  box-shadow: var(--en-shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.en-card:hover,
.en-card:focus-visible {
  border-color: var(--en-deep);
  box-shadow: var(--en-shadow-sm);
  outline: none;
}

.en-card:disabled {
  opacity: 0.55;
  pointer-events: none;
}

.en-card img {
  width: 100%;
  flex: 1 1 auto;
  min-height: 48px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: transparent;
}

.en-card-label {
  display: block;
  flex: 0 0 auto;
  flex-shrink: 0;
  padding: 11px 12px 13px;
  font-size: clamp(13px, 0.35rem + 1vw, 15px);
  font-weight: 700;
  line-height: 1.35;
  background: #fff;
  color: var(--en-ink);
  overflow-wrap: anywhere;
  hyphens: auto;
}

.en-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.en-chip {
  appearance: none;
  flex: 1 1 calc(50% - 6px);
  border: 1px solid var(--en-line);
  background: #fff;
  border-radius: 15px;
  padding: 12px 14px;
  font: inherit;
  font-size: var(--en-text-sm);
  font-weight: 600;
  cursor: pointer;
  color: var(--en-heading);
}

.en-chip:hover,
.en-chip:focus-visible {
  border-color: var(--en-deep);
  color: var(--en-deep);
  outline: none;
}

.en-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Плашка формы: ширина = строка у чекбокса; при нехватке места строка переносится */
.en-form--phone {
  box-sizing: border-box;
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 12px 14px;
  gap: 8px;
  background: rgba(244, 248, 251, 0.92);
  border: 1px solid var(--en-line);
  border-radius: 18px;
  box-shadow: var(--en-shadow-sm);
}

.en-form--phone .en-field,
.en-form--phone .en-submit,
.en-form--phone .en-error {
  width: 100%;
}

.en-form--phone .en-field label {
  margin-bottom: 6px;
}

.en-form--phone .en-field input {
  min-height: 42px;
  padding: 0 12px;
  font-size: 15px;
  border-radius: 12px;
}

.en-form--phone .en-submit {
  min-height: 44px;
  font-size: 12px;
}

.en-form--phone .en-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
}

.en-form--phone .en-check input {
  margin: 2px 0 0;
  flex: 0 0 auto;
}

.en-form--phone .en-check span {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  line-height: 1.35;
}

.en-field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--en-muted);
  margin-bottom: 4px;
}

.en-field input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--en-line);
  border-radius: 14px;
  padding: 0 14px;
  font: inherit;
  font-size: var(--en-text);
  background: #fff;
  color: var(--en-heading);
}

.en-field input:focus {
  outline: 2px solid rgba(93, 138, 163, 0.35);
  border-color: var(--en-deep);
}

.en-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--en-muted);
}

.en-check input {
  margin-top: 2px;
  accent-color: var(--en-deep);
}

.en-submit {
  appearance: none;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  width: 100%;
  min-height: 50px;
  border: none;
  border-radius: 15px;
  background: var(--en-orange);
  background: linear-gradient(180deg, #ffb84a 0%, #ffa828 55%, #f59a16 100%);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--en-shadow-sm);
}

.en-submit::before {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 55%;
  height: 100%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(255, 255, 255, 0.15) 35%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(255, 255, 255, 0.15) 65%,
    transparent 100%
  );
  transform: skewX(-18deg);
  pointer-events: none;
  z-index: 1;
  animation: en-btn-shine 2.8s ease-in-out infinite;
}

.en-submit:hover:not(:disabled) {
  background: var(--en-orange-hot);
  filter: brightness(1.03);
}

.en-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.en-submit:disabled::before {
  animation: none;
  opacity: 0;
}

@keyframes en-btn-shine {
  0%,
  50% {
    left: -120%;
  }
  100% {
    left: 160%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .en-submit::before {
    animation: none;
    opacity: 0;
  }
}

.en-error {
  display: none;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #c0392b;
}

.en-error.is-visible {
  display: block;
}

.en-footer {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  font-size: clamp(10px, 1.4vw, 12px);
  color: rgba(255, 255, 255, 0.78);
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  box-sizing: border-box;
}

/* Подвал в нижнем поле (≥22px, растёт под политики) — fit и expanded */
.en-chat-stack:not(.en-chat-stack--thanks) .en-footer {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: var(--en-edge-y-bottom);
  min-height: var(--en-screen-gap);
  margin: 0;
  padding: 4px 8px;
  font-size: clamp(10px, 1.2vw, 11px);
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 12px;
  box-sizing: border-box;
  pointer-events: auto;
  overflow: hidden;
}

.en-chat-stack:not(.en-chat-stack--thanks) .en-footer.en-footer-measure {
  height: auto;
  min-height: 0;
  overflow: visible;
}

.en-footer-copy {
  color: rgba(255, 255, 255, 0.78);
  white-space: nowrap;
}

.en-footer-links {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 14px;
}

.en-footer-link {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.en-footer-link:hover,
.en-footer-link:focus-visible {
  color: #fff;
  outline: none;
}

.en-legal-inline {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 700;
  color: var(--en-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.en-legal-inline:hover,
.en-legal-inline:focus-visible {
  color: var(--en-dark);
  outline: none;
}

body.en-legal-open {
  overflow: hidden;
}

.en-legal-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.en-legal-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.en-legal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 45, 59, 0.55);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.en-legal-modal.is-open .en-legal-backdrop {
  opacity: 1;
}

.en-legal-dialog {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(82vh, 820px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 24px;
  border: 1px solid var(--en-line);
  box-shadow: var(--en-shadow);
  outline: none;
  transform: translateY(12px) scale(0.96);
  opacity: 0;
  transition:
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease;
}

.en-legal-modal.is-open .en-legal-dialog {
  transform: none;
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .en-legal-modal,
  .en-legal-backdrop,
  .en-legal-dialog {
    transition: none;
  }
}

.en-legal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 18px 12px 20px;
  border-bottom: 1px solid var(--en-line);
  flex: 0 0 auto;
}

.en-legal-title {
  margin: 0;
  flex: 1 1 auto;
  font-size: clamp(16px, 2.2vw, 20px);
  font-weight: 700;
  line-height: 1.3;
  color: var(--en-h1);
}

.en-legal-x {
  appearance: none;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--en-bg-brand);
  color: var(--en-heading);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.en-legal-x:hover,
.en-legal-x:focus-visible {
  background: var(--en-line);
  outline: none;
}

.en-legal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 16px 20px 22px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--en-body);
  -webkit-overflow-scrolling: touch;
}

.en-legal-body p {
  margin: 0 0 12px;
}

.en-legal-body p:last-child {
  margin-bottom: 0;
}

.en-legal-loading {
  color: var(--en-muted);
}

@media (max-width: 640px) {
  .en-legal-modal {
    padding: 0;
    align-items: stretch;
  }

  .en-legal-dialog {
    width: 100%;
    max-height: none;
    height: 100%;
    border-radius: 0;
    border: none;
  }

  .en-legal-head {
    padding: 14px 14px 10px 16px;
  }

  .en-legal-body {
    padding: 14px 16px 20px;
  }
}

.en-thanks {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--en-line);
  border-top: 0;
  border-radius: 0 0 var(--en-radius) var(--en-radius);
  box-shadow: var(--en-shadow);
  box-sizing: border-box;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.en-thanks.en-popup-scroll {
  overflow-y: auto;
}

.en-page--thanks {
  min-height: 100dvh;
  height: auto;
  overflow: auto;
}

.en-page--thanks .en-main--thanks {
  height: auto;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: var(--en-screen-gap) var(--en-gutter);
  box-sizing: border-box;
}

.en-chat-stack--thanks {
  --en-thanks-stack-h: 680px;
  width: var(--en-stack-w);
  max-width: 100%;
  align-self: center;
  height: var(--en-thanks-stack-h);
  max-height: min(var(--en-thanks-stack-h), calc(100dvh - 2 * var(--en-screen-gap)));
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.en-chat-stack--thanks .en-topbar {
  border-radius: var(--en-radius) var(--en-radius) 0 0;
  flex: 0 0 auto;
}

.en-chat-stack--thanks .en-thanks {
  flex: 1 1 auto;
  min-height: 0;
}

.en-chat-stack--thanks .en-footer {
  flex: 0 0 auto;
  min-height: auto;
  padding: 8px 10px;
}

.en-thanks-card {
  width: min(100%, 420px);
  background: transparent;
  border-radius: 0;
  padding: 0;
  text-align: center;
  box-shadow: none;
  border: none;
}

.en-thanks-card h1 {
  margin: 0 0 10px;
  font-size: clamp(1.35rem, 3vw, 1.6rem);
  font-weight: 800;
  color: var(--en-h1);
  letter-spacing: -0.02em;
}

.en-thanks-card p {
  margin: 0 0 20px;
  color: var(--en-lead);
  font-size: 15px;
  line-height: 1.5;
}

.en-thanks-card .en-submit {
  width: auto;
  min-width: 180px;
}

.en-socials {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.en-social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  color: #fff;
  text-decoration: none;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.en-social:hover,
.en-social:focus-visible {
  transform: translateY(-2px);
  filter: brightness(1.06);
  outline: none;
}

.en-social svg {
  width: 28px;
  height: 28px;
  display: block;
}

.en-social--telegram {
  background: linear-gradient(145deg, #54a9eb 0%, #2aabee 55%, #229ed9 100%);
}

.en-social--max {
  background: linear-gradient(145deg, #6ec8ff 0%, #7b6cff 48%, #9b4dff 100%);
}

.en-social--vk {
  background: linear-gradient(145deg, #5b9ee8 0%, #4680c2 100%);
}

.en-social--whatsapp {
  background: linear-gradient(145deg, #4fd67d 0%, #25d366 55%, #1ebe57 100%);
}

@keyframes enFade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes enDot {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (max-height: 700px) {
  .en-page.en-fit .en-card-label,
  .en-card-label {
    font-size: clamp(13px, 2vh, 15px);
    padding: 8px 10px 10px;
    min-height: 2.6em;
  }

  .en-page.en-fit .en-bubble,
  .en-bubble {
    font-size: clamp(14px, 2.1vh, 16px);
    padding: 10px 12px;
  }

  /* УТП остаются видимыми, но компактнее на низких экранах */
  .en-page.en-fit .en-panel-head {
    flex: 0 0 auto;
    min-height: auto;
  }

  .en-page.en-fit .en-benefits-rise-inner {
    padding: 8px 10px 10px;
  }

  .en-page.en-fit .en-benefits-lead {
    margin-bottom: 6px;
    font-size: clamp(12px, 1.8vh, 14px);
  }

  .en-page.en-fit .en-benefit-card {
    font-size: clamp(11px, 1.5vh, 12px);
    padding: 7px 8px;
    gap: 8px;
  }

  .en-page.en-fit .en-benefits-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }

  .en-page.en-fit .en-benefits-icon svg {
    width: 14px;
    height: 14px;
  }
}

/* Планшет: поля 24px, столбик на всю доступную ширину */
@media (max-width: 1100px) {
  :root {
    --en-gutter: 24px;
    --en-stack-w: min(100%, var(--en-panel-w));
  }
}

/* Телефон: поля 12px, скругление как на десктопе */
@media (max-width: 640px) {
  :root {
    --en-gutter: 12px;
    --en-topbar-h: 48px;
    --en-radius: 20px;
    --en-stack-w: min(100%, var(--en-panel-w));
    --en-text: 17px;
    --en-text-sm: 15px;
  }

  .en-bg {
    display: block;
  }

  html,
  body,
  html.en-fit,
  html.en-fit body {
    background: transparent;
  }

  .en-page,
  .en-page.en-fit {
    background: transparent;
  }

  .en-page.en-fit {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  .en-main,
  .en-page.en-fit .en-main {
    align-items: stretch;
    justify-content: center;
  }

  .en-main--thanks {
    align-items: center;
  }

  .en-chat-stack,
  .en-page.en-fit .en-chat-stack {
    width: var(--en-stack-w);
    max-width: 100%;
  }

  .en-page.en-fit .en-chat-stack {
    flex: 0 1 auto;
    align-self: stretch;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: visible;
  }

  .en-topbar {
    border-radius: var(--en-radius) var(--en-radius) 0 0;
    box-shadow: 0 8px 24px rgba(32, 45, 59, 0.18);
    min-height: var(--en-topbar-h);
  }

  .en-topbar-inner {
    padding: 6px 10px;
    gap: 8px;
  }

  .en-brand {
    flex: 1 1 0;
    min-width: 0;
    gap: 6px;
    overflow: hidden;
  }

  .en-brand-text {
    font-size: clamp(10px, 2.6vw, 13px);
    gap: 0.25em;
    min-width: 0;
    overflow: hidden;
  }

  .en-logo-mark {
    width: clamp(26px, 7vw, 32px);
    height: clamp(26px, 7vw, 32px);
  }

  .en-phone {
    flex: 0 0 auto;
    flex-shrink: 0;
    font-size: clamp(11px, 2.7vw, 13px);
    white-space: nowrap;
    min-width: auto;
  }

  .en-panel {
    min-height: 0;
    border-radius: 0 0 var(--en-radius) var(--en-radius);
    box-shadow: var(--en-shadow);
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .en-page.en-fit .en-panel {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
  }

  .en-thanks {
    border-radius: 0 0 var(--en-radius) var(--en-radius);
    padding: 0;
  }

  .en-page--thanks .en-main--thanks {
    align-items: center;
    justify-content: center;
    padding: var(--en-screen-gap) var(--en-gutter);
  }

  /* Мобилка: колонка чата целиком скроллится от шапки */
  .en-page--thanks .en-chat-stack--thanks {
    height: auto;
    max-height: calc(100dvh - 2 * var(--en-screen-gap) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .en-page--thanks .en-thanks {
    overflow: visible;
    flex: 0 0 auto;
    min-height: 0;
  }

  .en-page--thanks .en-footer {
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    gap: 4px 8px;
  }

  .en-page--thanks .en-footer-copy,
  .en-page--thanks .en-footer-link {
    white-space: normal;
  }

  .en-page.en-fit .en-feed {
    padding: 8px clamp(10px, 2.5vw, 14px) 4px;
    gap: 8px;
  }

  .en-page.en-fit .en-dock {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  .en-page.en-fit .en-cards {
    gap: 6px;
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }

  .en-page.en-fit .en-card {
    border-radius: clamp(12px, 3vw, 16px);
    min-height: 0;
  }

  .en-page.en-fit .en-card img {
    flex: 1 1 0;
    height: 0;
    min-height: 72px;
    max-height: none;
    aspect-ratio: auto;
    object-fit: cover;
  }

  .en-page.en-fit .en-card-label {
    font-size: clamp(10px, 2.6vw, 12px);
    padding: 6px 7px 7px;
    min-height: 2.2em;
    line-height: 1.25;
  }

  .en-page.en-fit.en-fit-scroll .en-dock,
  .en-page.en-fit.en-fit-measure .en-dock {
    overflow: visible;
  }

  .en-page.en-fit.en-fit-scroll .en-cards,
  .en-page.en-fit.en-fit-measure .en-cards {
    grid-template-rows: auto auto;
    height: auto;
  }

  .en-page.en-fit.en-fit-scroll .en-card img,
  .en-page.en-fit.en-fit-measure .en-card img {
    flex: 0 0 auto;
    height: auto;
    min-height: 80px;
    max-height: 130px;
    aspect-ratio: 4 / 3;
  }

  .en-benefits-rise-inner {
    padding: 10px clamp(10px, 2.5vw, 14px) 10px;
  }

  .en-benefits-lead {
    font-size: clamp(13px, 3.5vw, 15px);
    margin-bottom: 8px;
  }

  .en-benefits-list {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .en-benefit-card {
    font-size: clamp(12px, 3.3vw, 14px);
    align-items: center;
    padding: 8px 10px;
    border-radius: 12px;
  }

  .en-benefits-icon {
    width: clamp(28px, 7vw, 32px);
    height: clamp(28px, 7vw, 32px);
    border-radius: 9px;
  }

  .en-benefits-icon svg {
    width: 16px;
    height: 16px;
  }

  .en-page.en-fit .en-benefits-lead {
    font-size: clamp(13px, 3.5vw, 15px);
  }

  .en-page.en-fit .en-benefit-card {
    font-size: clamp(12px, 3.3vw, 14px);
    padding: 8px 10px;
  }

  .en-bubble {
    font-size: clamp(14px, 3.7vw, 16px);
    padding: 10px 12px;
    border-radius: 14px;
  }

  .en-page.en-fit .en-bubble {
    font-size: clamp(14px, 3.7vw, 16px);
  }

  .en-chip {
    font-size: var(--en-text-sm);
    padding: 13px 14px;
  }

  .en-form--phone .en-field input {
    font-size: 16px;
  }

  .en-form--phone .en-submit {
    font-size: 13px;
  }

  .en-row-avatar {
    width: clamp(26px, 7vw, 32px);
    height: clamp(26px, 7vw, 32px);
  }

  .en-row--bot {
    gap: 8px;
    max-width: 94%;
  }

  .en-cookie {
    flex-wrap: wrap;
    padding: 8px 12px;
    font-size: clamp(10px, 2.8vw, 12px);
  }

  .en-cookie-ok {
    width: 100%;
    min-height: 36px;
  }

  .en-bubble--choice {
    max-width: min(180px, 52vw);
  }

  .en-cards {
    gap: 8px;
  }

  .en-dock:has(.en-form--phone) {
    padding: 12px clamp(10px, 2.5vw, 14px) 16px;
  }

  .en-form--phone {
    width: max-content;
    max-width: 100%;
    margin: 0 auto;
    padding: 10px 12px;
    border-radius: 16px;
  }

  .en-form--phone .en-check {
    width: max-content;
    max-width: 100%;
    font-size: clamp(10px, 2.6vw, 11px);
    align-items: flex-start;
    gap: 6px;
  }

  .en-form--phone .en-check span {
    white-space: normal;
    line-height: 1.35;
  }

  .en-footer {
    min-height: auto;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    font-size: clamp(9px, 2.4vw, 11px);
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    gap: 6px 10px;
  }

  .en-footer-copy {
    color: rgba(255, 255, 255, 0.8);
    white-space: normal;
  }

  .en-footer-link {
    color: rgba(255, 255, 255, 0.95);
    font-size: clamp(9px, 2.4vw, 11px);
  }

  .en-chat-stack:not(.en-chat-stack--thanks) .en-footer {
    height: var(--en-edge-y-bottom);
    min-height: var(--en-screen-gap);
    padding: 3px 4px;
    font-size: clamp(8px, 2vw, 10px);
    gap: 2px 6px;
  }

  .en-social {
    width: clamp(44px, 12vw, 52px);
    height: clamp(44px, 12vw, 52px);
    border-radius: 14px;
  }

  .en-social svg {
    width: clamp(22px, 6vw, 28px);
    height: clamp(22px, 6vw, 28px);
  }
}
