/* ═══════════════════════════════════════════════════════
   ПЕРЕМЕННЫЕ ТЕМЫ
   Базовые — из Telegram, акценты — кофейные поверх
   ═══════════════════════════════════════════════════════ */
:root {
  /* Telegram передаёт свои цвета через CSS-переменные */
  --tg-bg:           var(--tg-theme-bg-color,       #ffffff);
  --tg-text:         var(--tg-theme-text-color,      #000000);
  --tg-hint:         var(--tg-theme-hint-color,      #555555);
  --tg-section-bg:   var(--tg-theme-section-bg-color, #f4f4f5);
  --tg-button:       var(--tg-theme-button-color,    #2AABEE);
  --tg-button-text:  var(--tg-theme-button-text-color, #ffffff);
  --tg-link:         var(--tg-theme-link-color,      #2AABEE);

  /* Наши акценты поверх Telegram */
  --accent:          #2AABEE;   /* основной — синий Telegram */
  --accent-dark:     #1a8fcc;   /* затемнённый при нажатии */
  --price-color:     #27AE60;   /* зелёный — цена выглядит позитивно */
  --badge-hit:       #E05C3A;   /* «Хит» — тёплый красный */
  --badge-new:       #2AABEE;   /* «Новинка» — синий */

  /* Размеры и отступы */
  --radius-card:     16px;
  --radius-btn:      12px;
  --radius-tab:      20px;
  --gap:             12px;
  --padding-h:       16px;

  /* Типографика */
  --font:   -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --text-xl: 20px;
  --text-lg: 17px;
  --text-md: 15px;
  --text-sm: 13px;

  /* Анимации */
  --transition-screen: 260ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-ui:     160ms ease;
}


/* ═══════════════════════════════════════════════════════
   СБРОС И БАЗОВЫЕ СТИЛИ
   ═══════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent; /* убираем синюю вспышку на тапе */
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;           /* скролл управляется внутри экранов */
  font-family: var(--font);
  font-size: var(--text-md);
  color: var(--tg-text);
  background: var(--tg-bg);
  -webkit-font-smoothing: antialiased;
}


/* ═══════════════════════════════════════════════════════
   ЭКРАНЫ — ПЕРЕХОДЫ
   Все экраны абсолютные, переключение через классы
   .active      — текущий экран (translateX 0)
   .slide-enter — входит справа
   .slide-exit  — уходит влево
   ═══════════════════════════════════════════════════════ */
.screen {
  position: fixed;
  inset: 0;                   /* top/right/bottom/left: 0 */
  display: flex;
  flex-direction: column;
  background: var(--tg-bg);
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--transition-screen),
    opacity var(--transition-screen);
  will-change: transform, opacity;
}

/* Активный экран */
.screen.active {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

/* Экран уходит влево (когда открываем следующий) */
.screen.slide-exit {
  transform: translateX(-30%);
  opacity: 0;
  pointer-events: none;
}


/* ═══════════════════════════════════════════════════════
   ЭКРАН 1: КАТАЛОГ
   ═══════════════════════════════════════════════════════ */

/* --- Шапка с логотипом --- */
.catalog-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px var(--padding-h) 12px;
  flex-shrink: 0;
  background: var(--tg-bg);
  box-shadow: 0 1px 0 rgba(0,0,0,0.07);
}

/* Полоса «Поделиться с другом» */
.share-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px var(--padding-h);
  background: linear-gradient(90deg, rgba(42,171,238,0.13), rgba(42,171,238,0.06));
  border-bottom: 1px solid rgba(42,171,238,0.18);
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  transition: background var(--transition-ui);
}
.share-strip:active {
  background: linear-gradient(90deg, rgba(42,171,238,0.24), rgba(42,171,238,0.12));
}
.share-strip-icon {
  font-size: 15px;
  line-height: 1;
}
.share-strip-text {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent);
}
.share-strip-arrow {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.7;
}

.logo-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.logo-name {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--tg-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logo-tagline {
  font-size: var(--text-sm);
  color: var(--tg-hint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logo-address {
  font-size: 11px;
  color: var(--tg-hint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.75;
}

/* --- Табы категорий --- */
.tabs-wrap {
  flex-shrink: 0;
  padding: 10px 0 10px var(--padding-h);
  background: var(--tg-bg);
  overflow: hidden;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-right: var(--padding-h);
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* IE */
}

.tabs::-webkit-scrollbar {
  display: none;                /* Chrome/Safari */
}

.tab {
  flex-shrink: 0;
  padding: 7px 16px;
  border-radius: var(--radius-tab);
  border: 1.5px solid rgba(0,0,0,0.1);
  background: transparent;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--tg-hint);
  cursor: pointer;
  transition:
    background var(--transition-ui),
    color var(--transition-ui),
    border-color var(--transition-ui),
    transform var(--transition-ui);
  user-select: none;
  min-height: 36px;
  display: flex;
  align-items: center;
}

/* Тёмная тема — граница светлее */
@media (prefers-color-scheme: dark) {
  .tab { border-color: rgba(255,255,255,0.12); }
}

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* Нажатие на таб */
.tab:active {
  transform: scale(0.95);
}

/* --- Сетка карточек --- */
.catalog-grid {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--gap) var(--padding-h) 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-content: start;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.catalog-grid::-webkit-scrollbar { display: none; }

/* --- Карточка в сетке --- */
.card {
  background: var(--tg-section-bg);
  border-radius: var(--radius-card);
  /* overflow: hidden убран — он обрезал кнопку снизу.
     Скругление верхних углов изображения перенесено на .card-img */
  display: block;
  cursor: pointer;
  transition: transform var(--transition-ui), box-shadow var(--transition-ui);
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Нажатие на карточку */
.card:active {
  transform: scale(0.97);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* Фото-область с градиентом и эмоджи */
.card-img {
  aspect-ratio: 1 / 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  overflow: hidden;
  position: relative;
  /* Скругляем только верхние углы — нижние прямые, к ним примыкает card-body */
  border-radius: var(--radius-card) var(--radius-card) 0 0;
}

/* Фото внутри card-img */
.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Бейдж «Хит» / «Новинка» на карточке */
.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #fff;
  z-index: 1;
}

.badge-hit   { background: var(--badge-hit); }
.badge-new   { background: var(--badge-new); }
.badge-promo { background: #8B2ECC; }  /* фиолетовый — выделяется среди хит/новинка */

/* Тело карточки — название, цена, кнопка */
.card-body {
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--tg-text);
  line-height: 1.3;
  min-height: 2.6em; /* всегда 2 строки — кнопки на одном уровне */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--price-color);
}

/* Строка: объём — цена */
.card-price-wrap {
  display: flex;
  align-items: baseline;
  gap: 0;
  flex-wrap: wrap;
}

.card-volume {
  font-size: 13px;
  font-weight: 500;
  color: var(--tg-text);
}

.card-sep {
  font-size: 13px;
  color: var(--tg-hint);
}

/* Акционная цена — старая зачёркнутая рядом */

.card-price-old {
  font-size: 12px;
  font-weight: 400;
  color: var(--tg-hint);
  text-decoration: line-through;
}

/* На экране детали */
.detail-price-new {
  font-size: 22px;
  font-weight: 800;
  color: var(--price-color);
}

.detail-price-old {
  font-size: 16px;
  font-weight: 400;
  color: var(--tg-hint);
  text-decoration: line-through;
  margin-left: 8px;
}

/* Кнопка «Выбрать» на карточке */
.btn-select {
  margin-top: 8px;
  width: 100%;
  min-height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-ui), transform var(--transition-ui);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-select:active {
  background: var(--accent-dark);
  transform: scale(0.97);
}

/* Кнопка «+ В корзину» на карточке */
.btn-cart-add {
  margin-top: 8px;
  width: 100%;
  min-height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-ui), transform var(--transition-ui);
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-cart-add:active {
  background: var(--accent-dark);
  transform: scale(0.97);
}

/* Степпер − qty + на карточке */
.card-stepper {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--tg-section-bg);
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  overflow: hidden;
  min-height: 36px;
}
.stepper-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-ui);
  flex-shrink: 0;
}
.stepper-btn:active { background: rgba(42,171,238,0.12); }
.stepper-qty {
  font-size: 15px;
  font-weight: 700;
  color: var(--tg-text);
  min-width: 24px;
  text-align: center;
}

/* --- Skeleton-анимация загрузки --- */
.skeleton {
  pointer-events: none;
  height: 200px;
  background: linear-gradient(
    90deg,
    var(--tg-section-bg) 25%,
    rgba(0,0,0,0.05) 50%,
    var(--tg-section-bg) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}


/* ═══════════════════════════════════════════════════════
   ЭКРАН 2: КАРТОЧКА ТОВАРА
   ═══════════════════════════════════════════════════════ */

/* Большое фото сверху */
.detail-hero {
  flex-shrink: 0;
  width: 100%;
  aspect-ratio: 4 / 4.3;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 80px;
}

.detail-hero-emoji {
  line-height: 1;
  /* Лёгкая тень под эмоджи */
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.2));
}

/* Бейдж на детальном фото */
.detail-badge-wrap {
  position: absolute;
  top: 12px;
  left: 16px;
}

.detail-badge-wrap .badge {
  position: static;
  font-size: 13px;
  padding: 4px 12px;
}

/* Прокручиваемое тело */
.detail-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px var(--padding-h) 0;
  scrollbar-width: none;
}

.detail-body::-webkit-scrollbar { display: none; }

/* Название + цена рядом */
.detail-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.detail-name {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--tg-text);
  line-height: 1.25;
  flex: 1;
}

.detail-price {
  font-size: 22px;
  font-weight: 800;
  color: var(--price-color);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Описание */
.detail-desc {
  font-size: var(--text-md);
  color: var(--tg-hint);
  line-height: 1.55;
  margin-bottom: 20px;
}

/* Блок отзыва */
.detail-review {
  background: var(--tg-section-bg);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.review-stars {
  color: #FFB800;
  font-size: 16px;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.review-rating {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--tg-text);
  margin-left: 6px;
}

.review-text {
  font-size: var(--text-sm);
  color: var(--tg-hint);
  line-height: 1.5;
  font-style: italic;
}

/* Степпер количества на экране детали */
.detail-stepper-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-top: 1px solid rgba(0,0,0,0.07);
  margin-bottom: 8px;
}
@media (prefers-color-scheme: dark) {
  .detail-stepper-wrap { border-top-color: rgba(255,255,255,0.08); }
}
.detail-stepper-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--tg-hint);
}
.detail-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--tg-section-bg);
  border: 1.5px solid var(--accent);
  border-radius: 12px;
  overflow: hidden;
}
.detail-stepper-btn {
  width: 44px;
  height: 40px;
  border: none;
  background: transparent;
  font-size: 22px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: background var(--transition-ui);
}
.detail-stepper-btn:active { background: rgba(42,171,238,0.12); }
.detail-stepper-qty {
  font-size: 17px;
  font-weight: 700;
  color: var(--tg-text);
  min-width: 32px;
  text-align: center;
}

/* Отступ под нативный MainButton Telegram */
.detail-bottom-spacer {
  height: 80px;
}


/* ═══════════════════════════════════════════════════════
   ЭКРАН 3: ПОДТВЕРЖДЕНИЕ
   ═══════════════════════════════════════════════════════ */
.confirm-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* центрирование через padding; flex-start фиксит WebKit-баг со скроллом */
  padding: 40px var(--padding-h) 100px;
  text-align: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Анимированная галочка */
.confirm-check {
  width: 80px;
  height: 80px;
  margin-bottom: 28px;
}

.check-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.check-circle {
  stroke: var(--accent);
  fill: none;
  stroke-dasharray: 150;
  stroke-dashoffset: 150;
}

.check-tick {
  stroke: var(--accent);
  fill: none;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
}

/* Запуск анимации при активации экрана */
#screen-confirm.active .check-circle {
  animation: draw-circle 0.4s ease forwards;
}

#screen-confirm.active .check-tick {
  animation: draw-tick 0.3s ease 0.35s forwards;
}

@keyframes draw-circle {
  to { stroke-dashoffset: 0; }
}

@keyframes draw-tick {
  to { stroke-dashoffset: 0; }
}

.confirm-label {
  font-size: var(--text-md);
  color: var(--tg-hint);
  margin-bottom: 6px;
}

.confirm-item-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--tg-text);
  margin-bottom: 4px;
}

.confirm-item-price {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--price-color);
  margin-bottom: 24px;
}

.confirm-hint {
  font-size: var(--text-sm);
  color: var(--tg-hint);
  line-height: 1.6;
}

/* ── Переключатель Самовывоз / Доставка ── */
.delivery-toggle {
  display: flex;
  gap: 0;
  background: var(--tg-section-bg);
  border-radius: 12px;
  padding: 4px;
  margin: 20px 0 16px;
  width: 100%;
}

.delivery-tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  border-radius: 9px;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--tg-hint);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}

.delivery-tab.active {
  background: var(--tg-bg);
  color: var(--tg-text);
  font-weight: 600;
  box-shadow: 0 1px 6px rgba(0,0,0,0.12);
}

/* ── Поля формы ── */
.delivery-fields {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.delivery-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.delivery-field.hidden {
  display: none;
}

.field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--tg-hint);
}

.field-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid rgba(0,0,0,0.1);
  border-radius: 10px;
  background: var(--tg-section-bg);
  color: var(--tg-text);
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s;
}

.field-input:focus {
  border-color: var(--accent);
}

@media (prefers-color-scheme: dark) {
  .field-input { border-color: rgba(255,255,255,0.1); }
  .delivery-tab.active { box-shadow: 0 1px 6px rgba(0,0,0,0.4); }
}


/* ═══════════════════════════════════════════════════════
   ПРОМО-БЛОКИ (вкладка «Акции»)
   ═══════════════════════════════════════════════════════ */

/* Контейнер — одна колонка вместо сетки */
.promo-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 12px var(--padding-h) 32px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.promo-list::-webkit-scrollbar { display: none; }

/* Карточка акции */
.promo-card {
  background: var(--tg-section-bg);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  flex-shrink: 0;
}

/* ── Плавающая полоска корзины ── */
.cart-bar {
  position: fixed;
  bottom: -80px;
  left: 12px;
  right: 12px;
  z-index: 9999; /* выше browser-main-btn */
  background: var(--tg-text);
  color: var(--tg-bg);
  border-radius: 16px;
  padding: 10px 10px 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.22);
  transition: bottom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cart-bar.visible {
  bottom: calc(var(--cart-bar-bottom, 16px) + env(safe-area-inset-bottom, 0px));
}
.cart-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cart-bar-icon { font-size: 22px; }
.cart-bar-count {
  font-size: 13px;
  opacity: 0.7;
  line-height: 1.2;
}
.cart-bar-price {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
}
.cart-bar-btn {
  flex-shrink: 0;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition-ui);
}
.cart-bar-btn:active { transform: scale(0.96); }

/* ── Список товаров на экране подтверждения ── */
.confirm-cart-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
  text-align: left;
}
.confirm-cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.confirm-cart-item-name {
  font-size: var(--text-md);
  font-weight: 500;
  color: var(--tg-text);
  flex: 1;
}
.confirm-cart-item-qty {
  font-size: var(--text-sm);
  color: var(--tg-hint);
  white-space: nowrap;
}
.confirm-cart-item-price {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--price-color);
  white-space: nowrap;
}
.confirm-total {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.08);
  margin-bottom: 20px;
}
@media (prefers-color-scheme: dark) {
  .confirm-total { border-top-color: rgba(255,255,255,0.08); }
}
.confirm-total-label {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--tg-text);
}
.confirm-total-price {
  font-size: 20px;
  font-weight: 800;
  color: var(--price-color);
}

/* ── Блок 1: Скидка на первый заказ ── */

/* Обёртка фото — relative для абсолютного бейджа */
.promo-photos {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  gap: 2px;
}

.promo-photos img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

/* Бейдж — поверх фото, в левом нижнем углу */
.promo-photos .promo-badge {
  position: absolute;
  bottom: 12px;
  left: 12px;
  margin: 0;
}

/* Тело — строго под фото, никогда не налезает */
.promo-body {
  padding: 10px 16px 12px;
  background: var(--tg-section-bg);
}

.promo-badge {
  display: inline-block;
  background: #8B2ECC;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 6px;
  margin-bottom: 6px;
}

.promo-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--tg-text);
  line-height: 1.3;
  margin-bottom: 4px;
}

.promo-title span {
  color: #8B2ECC;
}

.promo-desc {
  font-size: 14px;
  color: var(--tg-hint);
  line-height: 1.5;
  margin-bottom: 8px;
}

.promo-date {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--tg-hint);
}

.promo-date-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8B2ECC;
  flex-shrink: 0;
}

/* ── Блок 2: Кружки лояльности ── */
.promo-cups-body {
  padding: 20px 16px 16px;
}

.cups-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 6px;
  margin: 16px 0 7px;  /* 20px → 7px: отступ до кнопки сокращён на ~67% */
}

/* Одна кружка */
.cup {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: default;
}

.cup-svg {
  width: 100%;
  max-width: 46px;
  height: auto;
  transition: transform 0.2s;
}

/* Незакрашенная кружка — контур */
.cup-svg .cup-body { fill: none; stroke: var(--tg-hint); stroke-width: 2.5; }
.cup-svg .cup-handle { fill: none; stroke: var(--tg-hint); stroke-width: 2.5; }
.cup-svg .cup-rim { fill: none; stroke: var(--tg-hint); stroke-width: 2.5; }

/* Закрашенная кружка — чёрная заливка */
.cup.filled .cup-svg .cup-body { fill: var(--tg-text); stroke: var(--tg-text); }
.cup.filled .cup-svg .cup-handle { stroke: var(--tg-text); }
.cup.filled .cup-svg .cup-rim { fill: var(--tg-text); stroke: var(--tg-text); }

/* 6-я кружка — бесплатная, выделена акцентом */
.cup.free-cup .cup-svg .cup-body { fill: none; stroke: #8B2ECC; stroke-width: 2.5; }
.cup.free-cup .cup-svg .cup-handle { stroke: #8B2ECC; stroke-width: 2.5; }
.cup.free-cup .cup-svg .cup-rim { fill: none; stroke: #8B2ECC; stroke-width: 2.5; }
.cup.free-cup.filled .cup-svg .cup-body { fill: #8B2ECC; stroke: #8B2ECC; }
.cup.free-cup.filled .cup-svg .cup-handle { stroke: #8B2ECC; }
.cup.free-cup.filled .cup-svg .cup-rim { fill: #8B2ECC; stroke: #8B2ECC; }


.cup-label {
  font-size: 9px;
  font-weight: 600;
  color: #8B2ECC;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  opacity: 0;
}
.cup.free-cup .cup-label { opacity: 1; }

/* Кнопка «Отметить кружку» */
.cups-action {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn-cup-add {
  flex: 1;
  min-height: 44px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-ui), transform var(--transition-ui);
}
.btn-cup-add:active { background: var(--accent-dark); transform: scale(0.97); }

/* Кнопка «Сброс» — маленькая */
.btn-cup-reset {
  min-height: 44px;
  min-width: 44px;
  border: 1.5px solid rgba(0,0,0,0.1);
  border-radius: 12px;
  background: transparent;
  color: var(--tg-hint);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition-ui);
}
.btn-cup-reset:active { border-color: var(--accent); }

/* Статус свободной кружки */
.cups-status {
  text-align: center;
  font-size: 13px;
  color: var(--tg-hint);
  margin-top: 8px;
  margin-bottom: 14px;
}
.cups-status.ready {
  color: #8B2ECC;
  font-weight: 600;
  font-size: 14px;
}

.promo-items-hint {
  font-size: 12px;
  color: var(--tg-hint);
  margin-top: 10px;
  text-align: center;
}


/* ═══════════════════════════════════════════════════════
   ТЁМНАЯ ТЕМА
   Telegram передаёт тему через CSS-переменные автоматически.
   Эти правила — дополнительная страховка для браузерного превью.
   ═══════════════════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {
  :root {
    --tg-bg:         #1c1c1e;
    --tg-text:       #ffffff;
    --tg-hint:       #b0b0b5;
    --tg-section-bg: #2c2c2e;
  }

  .skeleton {
    background: linear-gradient(
      90deg,
      #2c2c2e 25%,
      rgba(255,255,255,0.06) 50%,
      #2c2c2e 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
  }

  .card { box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
}


/* ═══════════════════════════════════════════════════════
   АДАПТИВ
   ═══════════════════════════════════════════════════════ */

/* Маленькие экраны (< 360px — iPhone SE 1gen, старые Android) */
@media (max-width: 360px) {
  .card-name  { font-size: 13px; }
  .card-price { font-size: 14px; }
  .btn-select { font-size: 12px; min-height: 34px; }
  .detail-hero { font-size: 64px; }
}

/* Планшеты и большие телефоны в landscape (600px+) */
@media (min-width: 600px) {
  .catalog-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 16px 24px 32px;
  }

  .detail-hero {
    aspect-ratio: 16 / 7;
    max-height: 280px;
  }

  .catalog-header {
    padding: 16px 24px 14px;
  }

  .tabs-wrap {
    padding-left: 24px;
  }

  .promo-list {
    padding: 16px 24px 40px;
    scrollbar-width: thin; /* показываем скроллбар на десктопе */
  }

  /* Баннер акции: ограничиваем высоту — иначе 16:9 на 1200px = 675px высоты */
  .promo-photos {
    max-height: 240px;
  }
}

/* Десктоп (900px+) — приложение центрировано как планшет */
@media (min-width: 900px) {
  /* Фон за приложением */
  body {
    background: #e2e2ea;
  }

  /* Все экраны — 768px по центру вместо inset: 0 */
  .screen {
    left:  calc(50% - 384px);
    right: auto;
    width: 768px;
    box-shadow: 0 8px 48px rgba(0,0,0,0.18);
  }

  /* Cart-bar вписываем в панель */
  .cart-bar {
    left:  calc(50% - 384px + 12px);
    right: calc(50% - 384px + 12px);
  }

  /* Оффер-оверлей — тоже только в пределах панели */
  .offer-overlay {
    left:  calc(50% - 384px);
    right: calc(50% - 384px);
  }

  /* 4 колонки в каталоге */
  .catalog-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}


/* ═══════════════════════════════════════════════════════
   ОНБОРДИНГ — первый экран с приветствием
   ═══════════════════════════════════════════════════════ */

.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001; /* выше оффера */
  background: var(--tg-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: offerFadeIn 0.3s ease;
}

.onboarding-overlay.hidden { display: none; }

.onboarding-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: offerSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.onboarding-emoji {
  font-size: 72px;
  line-height: 1;
  margin-bottom: 20px;
}

.onboarding-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--tg-text);
  line-height: 1.3;
  margin-bottom: 10px;
}

.onboarding-subtitle {
  font-size: 15px;
  color: var(--tg-hint);
  line-height: 1.55;
  margin-bottom: 28px;
}

.onboarding-list {
  list-style: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
  text-align: left;
}

.onboarding-list li {
  font-size: 15px;
  color: var(--tg-text);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--tg-section-bg);
  padding: 12px 16px;
  border-radius: 14px;
}

.onboarding-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.onboarding-btn {
  width: 100%;
  min-height: 50px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: background var(--transition-ui), transform var(--transition-ui);
}
.onboarding-btn:active {
  background: var(--accent-dark);
  transform: scale(0.98);
}


/* ═══════════════════════════════════════════════════════
   ОФФЕР — модальное окно при первом открытии
   ═══════════════════════════════════════════════════════ */

.offer-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: offerFadeIn 0.25s ease;
}

.offer-overlay.hidden {
  display: none;
}

.offer-card {
  background: var(--tg-bg);
  border-radius: 24px;
  padding: 32px 24px 24px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: offerSlideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.offer-emoji {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 16px;
}

.offer-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--tg-text);
  line-height: 1.3;
  margin-bottom: 10px;
}

.offer-subtitle {
  font-size: 15px;
  color: var(--tg-hint);
  line-height: 1.55;
  margin-bottom: 20px;
}

.offer-bullets {
  list-style: none;
  text-align: left;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

.offer-bullets li {
  font-size: 14px;
  color: var(--tg-text);
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.offer-bullets li::before {
  content: '•';
  color: var(--accent);
  font-weight: 700;
  font-size: 18px;
  line-height: 1.2;
  flex-shrink: 0;
}

.offer-btn {
  width: 100%;
  min-height: 48px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  transition: background var(--transition-ui), transform var(--transition-ui);
  font-family: var(--font);
}

.offer-btn:active {
  background: var(--accent-dark);
  transform: scale(0.98);
}

.offer-skip {
  background: none;
  border: none;
  font-size: 14px;
  color: var(--tg-hint);
  cursor: pointer;
  padding: 6px 12px;
  font-family: var(--font);
  transition: color var(--transition-ui);
}

.offer-skip:active {
  color: var(--tg-text);
}

@keyframes offerFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes offerSlideUp {
  from { opacity: 0; transform: translateY(32px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)     scale(1);    }
}
