:root {
  /* палитра лендинга «бумага + красная нить» */
  --paper: #EDE8DC;       /* фон-бумага */
  --paper-deep: #E4DECF;  /* подложка */
  --surface: #FBF9F3;     /* карточки */
  --ink: #1C2733;         /* текст */
  --ink-deep: #121B25;    /* тёмные блоки */
  --ink-soft: #46555f;    /* приглушённый текст */
  --thread: #B23A2B;      /* красная нить — акцент */
  --thread-deep: #943023;
  --chalk: #5E7284;       /* портновский мел — метки */
  --hairline: rgba(28,39,51,.22);

  --f-display: 'Oranienbaum', serif;
  --f-body: 'Golos Text', system-ui, sans-serif;
  --f-mono: 'PT Mono', monospace;

  /* алиасы под существующие правила компонентов */
  --accent: var(--thread);
  --bg: var(--paper);
  --text: var(--ink);
  --hint: var(--ink-soft);
  --card: var(--surface);
  --btn-text: #fff;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Атрибут hidden должен реально скрывать: иначе author-правила display:flex
   (.scenario/.deepen/.capsule-deepen) перебивают UA-правило [hidden]{display:none},
   и баннеры/блоки с hidden остаются видимыми. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--f-body);
  background: var(--bg);
  color: var(--text);
  /* в фуллскрине (Bot API 8.0+) сверху наезжают кнопки Telegram — отступаем на safe-area.
     В обычном режиме переменные = 0, поэтому ничего не смещается. */
  padding-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  padding-bottom: 40px;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--thread); color: var(--paper); }

/* ── типографика лендинга ──────────────────────────────────── */
/* крупные заголовки — Oranienbaum (тонкий серив-дисплей) */
.topbar__title, .hero__brand, .section-title, .result-head__title,
.quiz__q, .soon__title, .pdp__title, .cta__title, .chat__title,
.prof__name, .group-title, .scenario__name {
  font-family: var(--f-display);
  font-weight: 400;
  letter-spacing: .01em;
}
/* mono-метки (надзаголовки/eyebrow) */
.hero__title, .stylist-note__head, .section-sub, .field__label {
  font-family: var(--f-mono);
}
/* бренд-звезда и инлайн-иконки */
.hero__star { display: inline-block; height: 58px; width: auto; }
.ico-star { height: 1.05em; width: auto; vertical-align: -3px; margin-right: .4em; }
/* плейсхолдер вместо фото товара — фирменная звезда */
.ph-star { width: 44%; height: auto; opacity: .45; }

/* Экраны (мультиэкранный поток) */
.screen { display: none; }
.screen.active { display: block; }

/* Верхняя панель не-стартовых экранов */
.topbar { padding: 22px 20px 6px; }
.topbar__title { font-size: 22px; font-weight: 800; }

/* Кнопки */
.btn {
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 14px 18px;
  font-family: var(--f-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  color: var(--btn-text);
  background: var(--thread);
  transition: background .15s ease, transform .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; }
.btn--primary { background: var(--thread); }
.btn--primary:active { background: var(--thread-deep); }
.btn--ghost { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn--wide { display: block; width: calc(100% - 40px); margin: 22px 20px 0; }
.soon .btn { display: block; width: 100%; margin-top: 12px; }

/* Шапка */
.hero {
  text-align: center;
  padding: 28px 20px 22px;
}
.hero__star { font-size: 32px; }
.hero__brand { font-size: 15px; font-weight: 800; letter-spacing: .22em; margin-top: 4px; }
.hero__hi { font-size: 17px; color: var(--hint); margin-top: 10px; }
.hero__title { font-size: 14px; letter-spacing: .04em; text-transform: uppercase; color: var(--hint); margin-top: 14px; }
.dna-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 22px;
  border-radius: 999px;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.hero__tagline { margin: 14px auto 0; max-width: 320px; font-size: 15px; line-height: 1.45; color: var(--text); }

/* Секция */
.section-title { margin: 8px 20px 2px; font-size: 20px; }
.section-sub { margin: 0 20px 16px; font-size: 14px; color: var(--hint); }

/* Обложка капсулы (сет, собранный из референса) */
.set-capsule { margin: 0 20px 16px; border-radius: 16px; overflow: hidden; }
.set-capsule img { width: 100%; display: block; }

/* Сетка карточек */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 0 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}
.card:active { opacity: .9; }
.card__img {
  aspect-ratio: 3 / 4;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  overflow: hidden;
}
.card__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__img.noimg::after {
  content: ""; position: absolute; inset: 0;
  background: url(star.png) center / 44% no-repeat; opacity: .45;
}
.card__season {
  position: absolute; top: 8px; left: 8px;
  font-size: 11px; padding: 3px 8px; border-radius: 999px;
  background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(4px);
}
.card__badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  font-size: 11px; font-weight: 600; padding: 4px 10px;
  border-radius: 999px; color: #fff;
  background: linear-gradient(135deg, var(--accent), rgba(0,0,0,.7));
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.card__badge--pri { background: rgba(0,0,0,.65); }
.card__emoji { font-size: 54px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.25)); }
.card__body { padding: 12px 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.card__title { font-size: 14px; font-weight: 600; line-height: 1.3; min-height: 36px; }
.card__brand { font-size: 13px; color: var(--hint); }
.card__price { font-size: 15px; font-weight: 700; }
.card__btn {
  margin-top: 8px;
  border: none;
  border-radius: 3px;
  padding: 9px 10px;
  background: var(--thread);
  color: #fff;
  font-family: var(--f-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.card__btn:active { opacity: .85; }

.note {
  margin: 22px 20px 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--hint);
  text-align: center;
}

/* Мост к сценариям (на лендинге) */
.cta {
  margin: 26px 16px 0;
  padding: 20px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-top: 3px solid var(--thread);
  text-align: center;
}
.cta__title { font-size: 17px; font-weight: 700; }
.cta__sub { margin: 8px 0 16px; font-size: 14px; line-height: 1.45; color: var(--hint); }
.cta .btn { display: block; width: 100%; margin: 16px 0 0; }

/* Хаб сценариев */
.scenarios { padding: 6px 16px 0; display: flex; flex-direction: column; gap: 12px; }
.scenario {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--hairline);
  cursor: pointer;
  background: var(--card);
  border-radius: 8px;
  padding: 16px;
  color: var(--text);
}
.scenario:active { opacity: .9; }
.scenario__emoji { font-size: 30px; line-height: 1; }
.scenario__text { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.scenario__name { font-size: 16px; font-weight: 700; }
.scenario__desc { font-size: 13px; line-height: 1.4; color: var(--hint); }
.scenario__arrow { font-size: 20px; color: var(--hint); }

/* Интро сценария */
.intro { margin: 8px 20px 0; padding: 16px 18px; border-radius: 8px; background: var(--card); border: 1px solid var(--hairline); }
.intro p { margin: 0 0 8px; font-size: 14px; line-height: 1.5; }
.intro p:last-child { margin-bottom: 0; color: var(--hint); }

/* Форма сценария: поля + чипы */
.field { margin: 18px 20px 0; }
.field__label { font-size: 13px; font-weight: 600; color: var(--hint); margin-bottom: 10px; }
.field__hint { font-weight: 400; opacity: .8; }
.field__note { margin: 10px 20px 0; font-size: 13px; color: var(--hint); }

/* Слайдер бюджета */
#budgetSlider { margin-top: 14px; }
#budgetRange { width: 100%; accent-color: var(--accent); }
.range-val { margin-top: 8px; font-size: 14px; color: var(--text); }
.range-val b { font-size: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--hairline);
  background: var(--surface);
  color: var(--text);
  border-radius: 3px;
  padding: 9px 15px;
  font-size: 14px;
  cursor: pointer;
}
.chip--on { border-color: var(--thread); background: var(--thread); color: #fff; }

/* Результат капсулы */
.result-head { padding: 4px 20px 0; }
.result-head__title { font-size: 21px; font-weight: 800; }
.result-head__note { margin-top: 8px; font-size: 14px; line-height: 1.5; color: var(--hint); }
.group-title { margin: 22px 20px 10px; font-size: 15px; letter-spacing: .02em; }

/* Углубление профиля на лендинге */
.deepen { margin: 20px 16px 0; display: flex; flex-direction: column; gap: 10px; }
.deepen__title { margin: 4px 4px 4px; font-size: 15px; font-weight: 700; }

/* Профессиональный комментарий стилиста (фикс. под ДНК) на стартовой подборке */
.stylist-note {
  display: flex; gap: 12px; align-items: flex-start;
  margin: 0 16px 16px; padding: 14px 16px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--hairline); border-left: 3px solid var(--thread);
}
.stylist-note__ava { width: 26px; height: 26px; object-fit: contain; flex-shrink: 0; }
.stylist-note__head {
  font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 4px;
}
.stylist-note__text { font-size: 14px; line-height: 1.5; color: var(--text); }

/* Чат-уточнение капсулы */
.chat { margin: 22px 16px 0; padding: 16px; border-radius: 8px; background: var(--card); border: 1px solid var(--hairline); }
.chat__title { font-size: 15px; font-weight: 700; }
.chat__sub { font-size: 13px; color: var(--hint); margin: 4px 0 10px; line-height: 1.4; }
.chat__log { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; }
.chat__log:empty { display: none; }
.bubble { max-width: 85%; padding: 9px 13px; border-radius: 16px; font-size: 14px; line-height: 1.4; }
.bubble--you { align-self: flex-end; background: var(--thread); color: #fff; border-bottom-right-radius: 5px; }
.bubble--bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--hairline); border-bottom-left-radius: 5px; }
/* Индикатор «стилист печатает…»: три прыгающие точки в пузыре бота */
.bubble--typing { display: inline-flex; align-items: center; gap: 5px; padding: 13px 14px; }
.typing-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--hint);
  opacity: .35; animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: .18s; }
.typing-dot:nth-child(3) { animation-delay: .36s; }
@keyframes typingBounce {
  0%, 65%, 100% { transform: translateY(0); opacity: .35; }
  30% { transform: translateY(-5px); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .typing-dot { animation: typingFade 1.2s infinite ease-in-out; }
  @keyframes typingFade { 0%,100% { opacity: .3; } 50% { opacity: 1; } }
}

.chat__row { display: flex; gap: 8px; margin-top: 12px; }
.chat__input {
  flex: 1; border-radius: 4px; padding: 12px 14px; font-size: 15px;
  background: var(--surface); color: var(--text); border: 1px solid var(--hairline);
}
.chat__send {
  border: none; border-radius: 4px; width: 46px; font-size: 20px; cursor: pointer;
  background: var(--thread); color: #fff;
}
.chat__send:active { opacity: .85; }
.chat__hints { margin-top: 10px; font-size: 12px; color: var(--hint); line-height: 1.5; }

/* Ссылка-кнопка (профиль, навигация) */
.linkbtn {
  display: block; width: calc(100% - 40px); margin: 16px 20px 0; padding: 12px;
  border: none; background: none; color: var(--accent); font-size: 15px; font-weight: 600;
  cursor: pointer;
}
.linkbtn:active { opacity: .7; }

/* Блок «пройти тесты» в результате капсулы */
.capsule-deepen { margin: 24px 16px 0; display: flex; flex-direction: column; gap: 10px; }

/* Профиль */
.prof { display: flex; flex-direction: column; gap: 12px; padding: 8px 16px 0; }
.prof__card { background: var(--card); border: 1px solid var(--hairline); border-radius: 8px; padding: 16px; }
.prof__name { font-size: 16px; font-weight: 700; }
.prof__val { font-size: 14px; line-height: 1.45; color: var(--hint); margin: 6px 0 12px; }
.prof__card .btn { display: inline-block; }

/* Опросник «Что тебе по душе» */
.quiz__nav { display: flex; align-items: center; gap: 12px; padding: 6px 16px 0; }
.quiz__back {
  background: none; border: none; color: var(--accent); font-size: 14px;
  padding: 4px 6px; cursor: pointer; font-weight: 500;
}
.quiz__back:active { opacity: .7; }
.quiz__nav .quiz__progress { margin: 0; }
.quiz__progress { margin: 6px 20px; font-size: 13px; color: var(--hint); }
.quiz__q { margin: 8px 20px 4px; font-size: 18px; font-weight: 700; line-height: 1.35; }
.quiz__hint { margin: 0 20px 8px; font-size: 13px; color: var(--hint); }
.quiz__opts { display: flex; flex-direction: column; gap: 10px; padding: 10px 16px 0; }
.quiz__opt {
  text-align: left; border: 1.5px solid var(--hairline); background: var(--surface); color: var(--text);
  border-radius: 6px; padding: 14px 16px; font-size: 15px; line-height: 1.35; cursor: pointer;
}
.quiz__opt--on { border-color: var(--thread); }
.quiz__opt:active { opacity: .9; }
.quiz__opts--scale { flex-direction: row; gap: 8px; }
.quiz__num {
  flex: 1; border: 1.5px solid var(--hairline); background: var(--surface); color: var(--text);
  border-radius: 6px; padding: 16px 0; font-size: 18px; font-weight: 700; cursor: pointer;
}
.quiz__num:active { opacity: .9; }

/* Экран-заглушка */
.soon { margin: 30px 20px 0; padding: 28px 22px; border-radius: 10px; background: var(--card); border: 1px solid var(--hairline); text-align: center; }
.soon__emoji { font-size: 44px; }
.soon__title { margin-top: 12px; font-size: 19px; font-weight: 800; }
.soon__text { margin: 12px 0 20px; font-size: 14px; line-height: 1.5; color: var(--hint); }

/* ===== Карточка товара (шит) + корзина · покупательский флоу ===== */
.card--tap { cursor: pointer; }
.card--tap:active { opacity: .9; }

/* Цена со старой/новой */
.price__old { color: var(--hint); text-decoration: line-through; margin-right: 8px; font-size: 15px; }
.price__cur { font-size: 20px; font-weight: 800; }

/* Доп.скидка через FA */
.fa__row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.fa__badge { background: var(--accent); color: var(--btn-text); font-size: 12px; font-weight: 800;
  padding: 4px 10px; border-radius: 999px; }
.fa__price { font-size: 18px; font-weight: 800; }
.fa__note { margin-top: 6px; font-size: 12px; line-height: 1.45; color: var(--hint); }

/* Шит (overlay снизу) */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45);
  opacity: 0; transition: opacity .22s ease; }
.sheet.open .sheet__backdrop { opacity: 1; }
.sheet__panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto;
  overscroll-behavior: contain;          /* скролл шита не «пробивается» на ленту за ним */
  background: var(--bg); border-radius: 16px 16px 0 0; transform: translateY(100%);
  transition: transform .24s cubic-bezier(.2,.8,.2,1); padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
.sheet.open .sheet__panel { transform: translateY(0); }
/* пока открыт шит — фон (лента) не скроллится */
body.pdp-open { overflow: hidden; }
.sheet__close { position: absolute; top: 12px; right: 12px; z-index: 2; width: 34px; height: 34px;
  border: none; border-radius: 999px; background: rgba(0,0,0,.5); color: #fff; font-size: 16px; cursor: pointer; }

/* Галерея со свайпом */
.pdp__gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; border-radius: 16px 16px 0 0; }
.pdp__gallery::-webkit-scrollbar { display: none; }
.pdp__slide { flex: 0 0 100%; scroll-snap-align: center; aspect-ratio: 3/4; background: var(--card); }
.pdp__slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pdp__slide--empty { display: flex; align-items: center; justify-content: center; font-size: 64px; }
.pdp__dots { display: flex; justify-content: center; gap: 6px; padding: 10px 0 2px; }
.pdp__dot { width: 6px; height: 6px; border-radius: 999px; background: var(--hint); opacity: .4; }
.pdp__dot.on { opacity: 1; background: var(--accent); }

.pdp__body { padding: 8px 20px 0; }
.pdp__brand { font-size: 13px; color: var(--hint); font-weight: 600; }
.pdp__title { font-size: 19px; font-weight: 800; margin: 4px 0 12px; line-height: 1.3; }
.pdp__price { margin-bottom: 4px; }
.pdp__fa { margin: 8px 0 4px; }

.pdp__sizelabel, .pdp__sizenote { font-size: 13px; color: var(--hint); margin: 16px 0 8px; }
.pdp__sizerow { display: flex; flex-wrap: wrap; gap: 8px; }
.pdp__size { min-width: 44px; padding: 9px 12px; border-radius: 4px; border: 1.5px solid var(--hairline);
  background: var(--surface); color: var(--text); font-size: 14px; font-weight: 700; cursor: pointer; }
.pdp__size.sel { border-color: var(--thread); background: var(--thread); color: #fff; }
.pdp__size:disabled { opacity: .35; text-decoration: line-through; cursor: default; }
.pdp .btn--wide { margin: 18px 0 0; width: 100%; }
.btn--done { background: var(--card); color: var(--text); }
.pdp__store { display: block; text-align: center; margin: 16px 0 4px; color: var(--accent);
  font-size: 14px; font-weight: 600; text-decoration: none; }

/* Кнопка корзины — sticky-футер шита: всегда видна при прокрутке содержимого */
.pdp__cta { position: sticky; bottom: 0; margin-top: 12px; padding: 12px 20px calc(14px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--hairline); }
.pdp__cta #pdpAdd { margin: 0; width: 100%; }

/* Подсветка размеров, когда нажали «в корзину» без выбора */
.pdp__sizes--ask .pdp__sizelabel, .pdp__sizes--ask .pdp__sizenote { color: var(--thread); font-weight: 700; }
.pdp__sizes--ask .pdp__size:not(:disabled) { border-color: var(--thread); animation: pdpSizePulse .5s ease 2; }
@keyframes pdpSizePulse { 50% { background: color-mix(in srgb, var(--thread) 16%, transparent); } }

/* Плавающая корзина */
.cartbar { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 40; display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px;
  border-radius: 8px; background: var(--thread); color: #fff;
  box-shadow: 0 8px 28px rgba(18,27,37,.32); }
.cartbar__info { flex: 1; min-width: 0; }
.cartbar__count { font-size: 12px; opacity: .85; }
.cartbar__total { font-size: 17px; font-weight: 800; }
.cartbar__go { background: rgba(255,255,255,.18); color: var(--btn-text); }

/* Чекаут */
.checkout-list { padding: 8px 16px 0; }
.co-row { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--card); }
.co-row__img { flex: 0 0 64px; width: 64px; height: 82px; border-radius: 12px; overflow: hidden;
  background: var(--card); display: flex; align-items: center; justify-content: center; font-size: 26px; }
.co-row__img img { width: 100%; height: 100%; object-fit: cover; }
.co-row__b { flex: 1; min-width: 0; }
.co-row__title { font-size: 14px; font-weight: 700; line-height: 1.3; }
.co-row__meta { font-size: 12px; color: var(--hint); margin: 3px 0 5px; }
.co-row__old { color: var(--hint); text-decoration: line-through; margin-right: 8px; font-size: 13px; }
.co-row__fa { font-size: 15px; font-weight: 800; }
.co-row__del { flex: 0 0 auto; border: none; background: none; color: var(--hint); font-size: 16px;
  padding: 6px; cursor: pointer; }
.co-tot__row { display: flex; justify-content: space-between; font-size: 14px; padding: 4px 0; }
.co-tot__save { color: var(--accent); font-weight: 700; }
.co-tot__grand { font-size: 17px; font-weight: 800; margin-top: 6px; padding-top: 10px;
  border-top: 1px solid rgba(127,127,127,.2); }
.card__oldprice { color: var(--hint); text-decoration: line-through; font-weight: 500; font-size: 13px; }

/* Запас снизу, когда висит плавающая корзина — чтобы низ контента не прятался под баром */
body.has-cartbar { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

/* ===== Карточка стилиста: размеры-инфо (не кликабельны) + тумблер «отдать скидку» ===== */
span.pdp__size { cursor: default; }
.pdp__size--oos { opacity: .4; text-decoration: line-through; }
.st-give { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 12px;
  border: 1px solid var(--hairline); border-radius: 8px; background: var(--surface); cursor: pointer; }
.st-give input { margin-top: 2px; width: 18px; height: 18px; accent-color: var(--thread); flex: 0 0 auto; }
.st-give__txt { font-size: 14px; font-weight: 700; line-height: 1.3; }
.st-give__hint { display: block; font-size: 12px; font-weight: 400; color: var(--hint); margin-top: 4px; }
