/* =====================================================================
   Витрина «Ямал Гурмэ» - дизайн-проход (план 2026-09-25, карта 06, Р15).

   Палитра из логотипа: полярная ночь, снег, наст и брусника - единственный
   акцент. Фирменный приём - черта буквы «Э» из логотипа («ГУРМЭ—»):
   подписи разделов, строки городов и активная вкладка продолжаются
   линией горизонта. Шрифт системный (карта 06: без внешних ресурсов,
   холодный запуск до 3 с) - характер в весе и разрядке: тяжёлые заголовки
   как «ЯМАЛ», разреженные прописные подписи как «Г У Р М Э».

   Внутри Telegram цвета по-прежнему приходят из --tg-theme-* (путь Mini App
   не меняется); запасные значения ниже - цвета приложения и браузера.
   ===================================================================== */

:root {
  --night: #101418;      /* полярная ночь: текст, кнопки, статус-бар, сплэш */
  --snow: #ffffff;       /* снег: фон */
  --ice: #eff2f3;        /* наст: поверхности */
  --berry: #a3162e;      /* брусника: единственный акцент */
  --berry-soft: #f6e8eb;
  --ok: #1f6b45;         /* только состояния «оплачен» и «доставлен» */
  --ok-soft: #e5f1ea;

  --bg: var(--tg-theme-bg-color, var(--snow));
  --fg: var(--tg-theme-text-color, var(--night));
  --hint: var(--tg-theme-hint-color, #66707a);
  --link: var(--tg-theme-link-color, var(--berry));
  --btn: var(--tg-theme-button-color, var(--night));
  --btn-fg: var(--tg-theme-button-text-color, var(--snow));
  --card: var(--tg-theme-secondary-bg-color, var(--ice));
  --brand: var(--berry);
  --brand-soft: var(--berry-soft);
  /* Линии - от цвета текста: верно и на снегу, и в тёмной теме Telegram. */
  --line: rgba(16, 20, 24, .1);
  --line: color-mix(in srgb, var(--fg) 11%, transparent);
  --field: #c8d0d5;
  --field: color-mix(in srgb, var(--fg) 20%, transparent);

  --radius: 14px;
  --tabbar-h: 60px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--tg-theme-bg-color, #0c1013);
    --fg: var(--tg-theme-text-color, #eef2f3);
    --hint: var(--tg-theme-hint-color, #98a3ab);
    --link: var(--tg-theme-link-color, #ec6376);
    --btn: var(--tg-theme-button-color, #eef2f3);
    --btn-fg: var(--tg-theme-button-text-color, #0c1013);
    --card: var(--tg-theme-secondary-bg-color, #161c20);
    --brand: #ec6376;
    --brand-soft: #3b1c23;
    --ok: #6fcf97;
    --ok-soft: #173325;
  }
}

/* ---- Основа ------------------------------------------------------------- */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 28px);
}

h1 {
  margin: 8px 0 14px;
  font-size: 1.55rem;
  line-height: 1.18;
  font-weight: 800;
  letter-spacing: -0.02em;
}
h2 { margin: 22px 0 8px; font-size: 1.1rem; font-weight: 750; letter-spacing: -0.01em; }

a { color: var(--link); text-decoration: none; }
b, strong { font-weight: 700; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.muted { color: var(--hint); font-size: .9rem; }
.note { margin: 8px 0; color: var(--hint); font-size: .9rem; }
.price { color: var(--fg); font-variant-numeric: tabular-nums; }

/* Подпись раздела с чертой «Э»: прописные вразрядку, дальше - горизонт. */
.section-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 26px 0 12px;
  color: var(--hint);
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .26em;
  text-transform: uppercase;
}
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Шапка, вкладки кабинета и подвал сайта из base.html - только для обычного
   браузера (карта 08 ЕФ8.2; с 03.10 - на любом экране): их показывают
   shell.css и desktop.css; приложение и Mini App видят вкладки внизу. */
.site-header, .cabinet-tabs, .site-footer { display: none; }

/* Сообщения (messages framework) */
.flash {
  margin: 12px 16px 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--card);
  font-size: .95rem;
}
.flash.error { color: var(--brand); }

.error-box {
  margin: 10px 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: .95rem;
  font-weight: 600;
}

/* История бонусов (страница «Бонусы» кабинета, план
   2026-10-03-сайт-всё-внутри-главной): операция слева, подписанная сумма справа. */
.bonus-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.bonus-row .name { font-weight: 600; }
.bonus-amount { white-space: nowrap; font-variant-numeric: tabular-nums; }
.bonus-plus { color: var(--ok); }

/* ---- Нижняя панель вкладок (карта 06, пункт 1) -------------------------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg);
  border-top: 1px solid var(--line);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .tabbar {
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
  }
}
.tabbar a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--hint);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.tabbar a.active { color: var(--fg); }
/* Активная вкладка - короткая черта горизонта сверху, цветом акцента. */
.tabbar a.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 22px;
  height: 2px;
  margin-left: -11px;
  border-radius: 0 0 2px 2px;
  background: var(--brand);
}
.tab-icon { position: relative; display: block; width: 24px; height: 24px; }
.tab-icon svg { display: block; width: 24px; height: 24px; }
.badge {
  position: absolute;
  top: -6px;
  left: 15px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  font-size: .66rem;
  font-style: normal;
  font-weight: 750;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}

/* ---- Главная: знак, приветствие, плитки, доставка ----------------------- */

.brand-mark { width: 132px; margin: 6px auto 18px; color: var(--fg); }
.brand-mark svg, .auth-brand svg, .start-logo svg { display: block; width: 100%; height: auto; }

.welcome-head { padding: 4px 4px 2px; text-align: center; }
.welcome-title { margin: 0 0 8px; font-size: 1.4rem; line-height: 1.22; }
.welcome-cta { margin: 0; color: var(--link); font-weight: 650; font-size: 1rem; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile {
  position: relative;
  display: flex;
  align-items: flex-end;
  aspect-ratio: 1;
  padding: 12px;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--fg);
  font-size: 1rem;
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: -0.01em;
}
/* Иллюстрация раздела (эскизы владельца 2026-09-29): по центру сверху,
   линии цветом текста темы, одна деталь брусничная. Ширина 46% оставляет
   под рисунком место трём строкам названия. */
.tile-art {
  position: absolute;
  top: 9%;
  left: 50%;
  z-index: -1;
  width: 46%;
  height: auto;
  aspect-ratio: 1;
  transform: translateX(-50%);
  color: var(--fg);
}
.tile-art .ac { color: var(--brand); }
.tile:active { transform: scale(.985); }

.welcome {
  margin: 8px 0 4px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--card);
  font-size: .95rem;
}
.welcome .section-label { margin: 0 0 8px; }
.welcome p { margin: 0 0 6px; }
.welcome p:last-child { margin-bottom: 0; }

/* ---- Раздел и товар ------------------------------------------------------ */

.product-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.product-row img, .photo-placeholder {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: var(--card);
  object-fit: cover;
}
.product-row .info { flex: 1; min-width: 0; }
.product-row .name { color: var(--fg); font-weight: 700; }
.product-photo {
  display: block;
  width: 100%;
  max-height: 340px;
  margin: 8px 0 12px;
  border-radius: var(--radius);
  object-fit: cover;
}

/* ---- Кнопки ------------------------------------------------------------ */

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  border: 0;
  border-radius: 12px;
  background: var(--btn);
  color: var(--btn-fg);
  font: inherit;
  font-weight: 650;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease;
}
button:active, .btn:active { transform: scale(.985); opacity: .92; }
button:disabled { opacity: .45; cursor: default; transform: none; }
/* Подпись с таймером («через 39 с») - одним потоком текста: во флексе число
   стало бы отдельным элементом, и пробелы вокруг него схлопнулись бы. Только
   широкие кнопки: у строк городов span - это линия горизонта. */
.btn-wide > span { display: contents; }
.btn-wide, button.btn-wide { display: flex; width: 100%; min-height: 54px; margin: 12px 0; font-size: 1.02rem; }
.btn-quiet { background: var(--card); color: var(--fg); }
.btn-small { min-height: 36px; padding: 6px 14px; border-radius: 10px; font-size: .9rem; }
/* Оплата - единственная кнопка цветом акцента: деньги - главное действие. */
.btn-pay { background: var(--brand); color: #fff; }
form.inline { display: inline; }

/* ---- Корзина и итоги ----------------------------------------------------- */

.cart-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.cart-line .info { flex: 1; min-width: 0; }
.cart-line .name { font-weight: 650; }
.qty { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.qty button {
  min-width: 36px;
  min-height: 36px;
  padding: 4px 10px;
  border-radius: 10px;
  background: var(--card);
  color: var(--fg);
  font-size: 1.1rem;
}

.totals {
  margin: 14px 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--card);
  font-variant-numeric: tabular-nums;
}
.totals .row { display: flex; justify-content: space-between; gap: 12px; margin: 5px 0; }
.totals .sub { margin: -2px 0 6px; color: var(--hint); font-size: .85rem; }
/* Полоска до бесплатной доставки - та же черта горизонта. */
.progress { height: 3px; margin: 2px 0 8px; overflow: hidden; border-radius: 2px; background: var(--line); }
.progress-fill { height: 100%; background: var(--brand); }

/* ---- Формы ----------------------------------------------------------------- */

label { display: block; margin: 16px 0 6px; font-size: .9rem; font-weight: 650; }
input[type="text"], input[type="tel"], textarea {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--field);
  border-radius: 12px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 1.05rem;
}
input[type="text"]:focus, input[type="tel"]:focus, textarea:focus {
  outline: none;
  border-color: var(--fg);
  box-shadow: 0 0 0 3px rgba(163, 22, 46, .18);
}
textarea { min-height: 80px; resize: vertical; }
.section-title { margin: 18px 0 0; font-weight: 750; }
.addr-row { display: flex; gap: 8px; }
.addr-row label { flex: 1; min-width: 0; }
.addr-row input { margin-top: 6px; }
.consent { margin: 12px 0; color: var(--hint); font-size: .82rem; line-height: 1.45; }
.check { display: flex; align-items: center; gap: 10px; margin: 16px 0 4px; font-weight: 650; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }

/* ---- Вход по номеру и коду (карта 06, пункт 4) --------------------------- */

.auth { padding: 48px 16px; text-align: center; }
.auth-brand { width: 176px; margin: 20px auto 30px; color: var(--fg); }
.auth-form { margin: 8px 0 16px; }
.code-input {
  min-height: 64px;
  padding-left: calc(14px + .42em);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: .42em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Экран звонка (план 2026-09-30-вход-по-звонку): номер SMS.ru крупно
   текстом - его видно и на компьютере, где набирают с телефона; статус
   отсчёта - строкой под кнопкой, «Не получается?» - раскрывашкой. */
.call-number {
  margin: 10px 0 2px;
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.call-status { margin: 14px 0 4px; font-weight: 650; font-variant-numeric: tabular-nums; }
/* Подпись ответа на ручную проверку - живая область (role="status"): пустая
   остаётся в дереве доступности без высоты, иначе диктор не объявил бы
   первый текст в ней. */
.call-note { margin: 4px 0; color: var(--brand); font-size: .92rem; }
.call-note:empty { margin: 0; }
/* На нуле отсчёта номер и «Позвонить» прячет JS атрибутом hidden: .btn-wide
   с display: flex иначе перебил бы его. */
.call-screen .call-dial[hidden] { display: none; }
.call-help { margin: 14px 0 20px; padding: 12px 14px; border-radius: 12px; background: var(--card); }
.call-help summary { font-weight: 650; cursor: pointer; }
.call-help ul { margin: 10px 0 0; padding-left: 20px; color: var(--hint); font-size: .9rem; line-height: 1.45; }
.call-help li { margin: 4px 0; }

/* ---- Заказ: метка состояния, панель оплаты (карта 06, пункт 5) ----------- */

.order-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: -4px 0 12px; }
.state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--card);
  color: var(--fg);
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}
.state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.state-awaiting_payment { background: var(--brand-soft); color: var(--brand); }
.state-paid, .state-delivered { background: var(--ok-soft); color: var(--ok); }
.state-cancelled { color: var(--hint); }

.actionbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  z-index: 19;
  padding: 10px 16px;
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.actionbar .btn { max-width: 608px; margin: 0 auto; }
main:has(.actionbar) { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 100px); }

.paid-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--card);
  font-weight: 650;
}
.paid-banner::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
}

.order-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.order-row .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.order-row .row + .row { margin-top: 4px; }
.order-link { display: block; color: inherit; text-decoration: none; }

/* ---- Профиль: карточки строк (карта 06) ----------------------------------- */

.list-card { margin: 0 0 12px; padding: 2px 16px; border-radius: var(--radius); background: var(--card); }
.list-card > p {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 0;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.list-card > p:last-child { border-bottom: 0; }
.list-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--fg);
  font-weight: 650;
}
.list-link::after, .links a::after { content: "\203A"; color: var(--hint); font-size: 1.3rem; line-height: 1; }
.links { list-style: none; }
.links li + li { border-top: 1px solid var(--line); }
.links a { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; color: var(--fg); }

/* ---- Готово и пустые экраны --------------------------------------------- */

.done { padding: 32px 0; text-align: center; }
.done .mark { font-size: 2.6rem; line-height: 1; margin-bottom: 8px; }

/* ---- Выбор города: полярная ночь (карта 09, Р28; карта 06) ---------------
   Первый экран приложения продолжает сплэш: тот же цвет ночи, белый знак,
   города - строки с линией горизонта до стрелки. Свои цвета, не тема
   Telegram: в Mini App этот экран не открывается. */

.start-page {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--night);
  color: #eef2f3;
}
.start {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top, 0px)) 24px calc(24px + var(--safe-bottom));
}
.start-logo { width: min(62vw, 250px); margin: 11vh auto 0; color: #fff; }
.start-cities { margin-top: auto; padding-top: 40px; }
.start .section-label { margin: 0 0 4px; color: rgba(238, 242, 243, .6); }
.start .section-label::after { background: rgba(238, 242, 243, .22); }
.city {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 66px;
  padding: 18px 2px;
  border: 0;
  border-bottom: 1px solid rgba(238, 242, 243, .14);
  border-radius: 0;
  background: none;
  color: #fff;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  text-align: left;
}
.city:active { transform: none; opacity: .7; }
.city-line {
  flex: 1;
  height: 1px;
  background: rgba(238, 242, 243, .3);
  transform-origin: left center;
}
.city-note {
  color: rgba(238, 242, 243, .55);
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .24em;
  text-transform: uppercase;
}
.city-go { color: #ec6376; font-size: 1.5rem; font-weight: 400; line-height: 1; }
.city-soon { color: rgba(238, 242, 243, .42); cursor: default; }
.city-soon:disabled { opacity: 1; }
.start-foot { margin: 22px 0 0; color: rgba(238, 242, 243, .55); font-size: .88rem; }
.start .error-box { background: rgba(236, 99, 118, .16); color: #ff9aa8; }

@media (prefers-reduced-motion: no-preference) {
  .city-line { animation: horizon .9s cubic-bezier(.2, .7, .2, 1) both; }
  .city:nth-of-type(2) .city-line { animation-delay: .07s; }
  .city:nth-of-type(3) .city-line { animation-delay: .14s; }
  .city:nth-of-type(4) .city-line { animation-delay: .21s; }
  .city:nth-of-type(n+5) .city-line { animation-delay: .28s; }
}
@keyframes horizon { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@media (prefers-reduced-motion: reduce) {
  button, .btn { transition: none; }
}
