/* AlexMobile — витрина в Telegram. Холодная палитра, SF Pro, чёрные кнопки как на сайте. */
:root {
  --paper: #eef0f3;
  --surface: #ffffff;
  --tile: #ffffff;
  --ink: #000000;
  --slate: #5b616e;
  --mist: #9aa0ac;
  --index-off: #7f8693;
  --line: #dadee5;
  --seg: #e1e4e9;
  --seg-on: #ffffff;
  --burnt: #c9510c;
  --ok: #1f8a4c;
  --pre: #a35e00;
  --err: #c5221f;
  --btn: #000000;
  --btn-ink: #ffffff;
  --sk1: #e2e5e9;
  --sk2: #eceef1;
  --ring: rgba(0, 0, 0, .16);
  --dot: rgba(0, 0, 0, .18);
  --dot-on: rgba(0, 0, 0, .72);
  --gutter: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #000000;
  --surface: #16181d;
  --tile: #ffffff;
  --ink: #f3f4f6;
  --slate: #a3a9b4;
  --mist: #646a76;
  --index-off: #6b717d;
  --line: #262a31;
  --seg: #121418;
  --seg-on: #2b2f37;
  --burnt: #ff7a33;
  --ok: #45cf86;
  --pre: #f0a640;
  --err: #ff6b62;
  --btn: #f3f4f6;
  --btn-ink: #000000;
  --sk1: #15171b;
  --sk2: #1e2126;
  --ring: rgba(255, 255, 255, .28);
  --dot: rgba(255, 255, 255, .25);
  --dot-on: rgba(255, 255, 255, .85);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--paper); }
html:not([data-theme]) { background: var(--tg-theme-bg-color, #eef0f3); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}
body.with-bar { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; user-select: none; -webkit-user-select: none; }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 8px; }
#app { max-width: 1100px; margin: 0 auto; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ───── шапка ───── */
.top { display: flex; align-items: center; gap: 10px; padding: 12px var(--gutter) 2px; }
.search {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 6px 0 12px; border-radius: 14px; background: var(--surface); color: var(--mist);
}
.search .ic { width: 20px; height: 20px; }
.search__input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; padding: 0;
  font: 400 17px/1 var(--font); color: var(--ink); -webkit-appearance: none; appearance: none;
}
.search__input::placeholder { color: var(--mist); }
.search__input::-webkit-search-cancel-button, .search__input::-webkit-search-decoration { display: none; -webkit-appearance: none; }
.search__clear { width: 32px; height: 32px; display: grid; place-items: center; color: var(--mist); }
.search__clear .ic { width: 18px; height: 18px; }
.cartbtn { position: relative; flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--surface); color: var(--ink); }
.cartbtn__count {
  position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--burnt); color: #fff; font: 600 11px/18px var(--font); text-align: center; font-variant-numeric: tabular-nums;
}

/* ───── типографский указатель разделов ───── */
.index {
  display: flex; gap: 20px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
  padding: 16px var(--gutter) 4px;
}
.index::-webkit-scrollbar, .subindex::-webkit-scrollbar, .minibar__track::-webkit-scrollbar, .gallery__track::-webkit-scrollbar { display: none; }
.index__item {
  flex: none; padding: 2px 0 6px; white-space: nowrap;
  font-size: 31px; line-height: 1.1; font-weight: 600; letter-spacing: -0.035em; color: var(--index-off);
  transition: color .2s ease;
}
.index__item[aria-pressed="true"] { color: var(--ink); }
.subindex { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 8px var(--gutter) 2px; }
.subindex__item {
  flex: none; height: 34px; padding: 0 14px; border-radius: 17px; white-space: nowrap;
  background: var(--surface); color: var(--slate); font-size: 15px; font-weight: 500;
}
.subindex__item[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

#minibar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
  box-shadow: 0 0.5px 0 var(--line);
  transform: translateY(-105%); transition: transform .24s cubic-bezier(.2, .8, .2, 1);
}
#minibar.on { transform: none; }
.minibar__track { display: flex; gap: 18px; overflow-x: auto; scrollbar-width: none; padding: 12px var(--gutter); max-width: 1100px; margin: 0 auto; }
.minibar__item { flex: none; white-space: nowrap; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--index-off); }
.minibar__item[aria-pressed="true"] { color: var(--ink); }

/* ───── сетка товаров ───── */
.sect { margin-top: 30px; }
.sect__title { margin: 0 0 12px; padding: 0 var(--gutter); font-size: 22px; line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; }
.sect__head { display: inline-flex; align-items: center; gap: 8px; font: inherit; letter-spacing: inherit; color: var(--ink); }
.sect__count { font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--mist); font-variant-numeric: tabular-nums; }
.sect__head .ic { width: 16px; height: 16px; margin-left: -4px; color: var(--mist); }
#home-content > .grid { margin-top: 18px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 12px; padding: 0 var(--gutter); }
.card { display: flex; flex-direction: column; min-width: 0; }
.card__media { position: relative; aspect-ratio: 1; border-radius: 22px; overflow: hidden; background: var(--sk1); transition: transform .15s ease, background-color .35s ease; }
.card__media.ready { background: var(--tile); }
.card:active .card__media { transform: scale(.98); }
.card__img { width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .35s ease; }
.card__img.in { opacity: 1; }
.card__title {
  margin-top: 10px; font-size: 15px; line-height: 1.3; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card__price {
  margin-top: 6px; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 7px;
  font-size: 16px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
}
.card__price--none { font-size: 15px; font-weight: 500; color: var(--slate); }
.card__old { font-size: 13px; font-weight: 400; color: var(--mist); }
.card__off { align-self: center; padding: 2px 6px; border-radius: 6px; background: var(--burnt); color: #fff; font-size: 12px; font-weight: 600; letter-spacing: 0; }
.card__tag { margin-top: 4px; font-size: 13px; color: var(--pre); }
.dots { display: flex; align-items: center; gap: 5px; margin-top: 8px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px var(--ring); }
.dots__more { margin-left: 2px; font-size: 12px; color: var(--mist); font-variant-numeric: tabular-nums; }

.found { margin: 20px var(--gutter) 14px; font-size: 15px; color: var(--slate); }
.empty { padding: 36px var(--gutter); color: var(--slate); }
.empty--full { min-height: 62vh; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.empty__title { margin-bottom: 6px; font-size: 21px; line-height: 1.25; font-weight: 600; letter-spacing: -0.015em; color: var(--ink); }
.empty p:not(.empty__title) { margin-bottom: 16px; max-width: 36ch; }

/* ───── магазин внизу ───── */
.store { margin: 44px var(--gutter) 0; padding-top: 22px; border-top: 1px solid var(--line); font-size: 15px; color: var(--slate); }
.store p { margin-bottom: 3px; }
.store a { color: var(--ink); }
.store__name { font-size: 17px; font-weight: 600; color: var(--ink); }
.store__actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 14px; }
.store__note { max-width: 58ch; font-size: 13px; line-height: 1.45; color: var(--mist); }
.pill { height: 40px; padding: 0 18px; border-radius: 20px; background: var(--btn); color: var(--btn-ink); font-size: 15px; font-weight: 600; white-space: nowrap; }
.pill--ghost { background: var(--surface); color: var(--ink); }

.backlink { display: inline-flex; align-items: center; gap: 2px; margin: 10px 6px 0; padding: 6px 8px; font-size: 16px; color: var(--ink); }
.backlink .ic { width: 20px; height: 20px; }

/* ───── карточка товара ───── */
.gallery { position: relative; }
.gallery__track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; background: var(--tile); }
.gallery__slide { flex: 0 0 100%; aspect-ratio: 1; scroll-snap-align: start; scroll-snap-stop: always; }
.gallery__img { width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .35s ease; }
.gallery__img.in { opacity: 1; }
.gallery__dots { display: flex; justify-content: center; gap: 6px; padding-top: 12px; pointer-events: none; }
.gallery__dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--dot); transition: width .25s ease, background .25s ease; }
.gallery__dots i.on { width: 18px; background: var(--dot-on); }
.gallery__share {
  position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 20px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .86); color: #000; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.gallery__share .ic { width: 20px; height: 20px; }

.pp { padding: 16px var(--gutter) 0; }
.pp__title { font-size: 25px; line-height: 1.16; font-weight: 600; letter-spacing: -0.025em; }
.pp__status { display: flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 15px; color: var(--slate); }
.pp__status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.pp__status.is-ok { color: var(--ok); }
.pp__status.is-pre { color: var(--pre); }
.price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 18px; }
.price__now { font-size: 36px; line-height: 1.05; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.price__now--request { font-size: 26px; letter-spacing: -0.02em; }
.price__old { font-size: 17px; color: var(--mist); font-variant-numeric: tabular-nums; }
.price__off { align-self: center; padding: 3px 8px; border-radius: 8px; background: var(--burnt); color: #fff; font-size: 13px; font-weight: 600; }
.pp__pay { margin-top: 14px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; border-radius: 13px; background: var(--seg); }
.seg__btn { height: 36px; padding: 0 6px; border-radius: 10px; text-align: center; font-size: 14px; font-weight: 500; color: var(--slate); transition: background .18s ease, color .18s ease; }
.seg__btn[aria-checked="true"] { background: var(--seg-on); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }

.pp__options { margin-top: 4px; }
.opt { margin-top: 22px; }
.opt__label { margin-bottom: 10px; font-size: 15px; color: var(--slate); }
.opt__label span { margin-left: 6px; font-weight: 500; color: var(--ink); }
.opt__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 9px; min-height: 42px; padding: 9px 14px; border-radius: 13px;
  background: var(--surface); font-size: 15px; line-height: 1.25; text-align: left;
  box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .15s ease;
}
.chip[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--ink); }
.chip--off { color: var(--mist); }
.chip--off .sw { opacity: .5; }
.sw { width: 20px; height: 20px; border-radius: 50%; flex: none; background: var(--c); box-shadow: inset 0 0 0 1px var(--ring); }

.block-title { margin: 30px 0 10px; font-size: 19px; line-height: 1.25; font-weight: 600; letter-spacing: -0.015em; }
.desc__body { max-width: 68ch; font-size: 16px; line-height: 1.5; }
.desc__body p, .desc__body ul, .desc__body ol, .desc__body table { margin: 0 0 10px; }
.desc__body ul, .desc__body ol { padding-left: 20px; }
.desc__body li { margin: 3px 0; }
.desc__body h2, .desc__body h3, .desc__body h4, .desc__body h5 { margin: 16px 0 6px; font-size: 17px; }
.desc__body table { width: 100%; border-collapse: collapse; font-size: 14px; }
.desc__body td, .desc__body th { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.desc__body a { text-decoration: underline; text-underline-offset: 2px; }
.desc--clamped .desc__body {
  max-height: 9.5em; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent);
}
.desc__more { margin-top: 6px; padding: 6px 0; font-size: 15px; font-weight: 600; }

.rows { margin-top: 30px; border-radius: 16px; overflow: hidden; background: var(--surface); }
.row { width: 100%; min-height: 50px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px 0 16px; font-size: 16px; }
.row + .row { border-top: 1px solid var(--line); }
.row .ic { width: 18px; height: 18px; color: var(--mist); }

/* ───── корзина и оформление ───── */
.page-title { margin: 16px var(--gutter) 0; font-size: 31px; line-height: 1.1; font-weight: 600; letter-spacing: -0.035em; }
.lines { margin-top: 14px; padding: 0 var(--gutter); }
.line { display: flex; gap: 14px; padding: 14px 0; }
.line + .line { border-top: 1px solid var(--line); }
.line__img { flex: none; width: 78px; height: 78px; border-radius: 16px; overflow: hidden; background: var(--tile); }
.line__pic { width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .3s ease; }
.line__pic.in { opacity: 1; }
.line__body { flex: 1; min-width: 0; }
.line__title { display: block; font-size: 15px; line-height: 1.3; }
.line__var { margin-top: 3px; font-size: 14px; color: var(--slate); }
.line__tag { margin-top: 3px; font-size: 13px; color: var(--pre); }
.line__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.line__price { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stepper { display: inline-flex; align-items: center; height: 34px; border-radius: 17px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.stepper button { width: 36px; height: 34px; display: grid; place-items: center; }
.stepper button:disabled { opacity: .35; cursor: default; }
.stepper .ic { width: 16px; height: 16px; stroke-width: 2.2; }
.stepper__n { min-width: 18px; text-align: center; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cart-pay { padding: 0 var(--gutter); }
.summary { margin: 24px var(--gutter) 0; }
.summary__row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 16px; font-variant-numeric: tabular-nums; }
.summary__row--total { font-size: 23px; font-weight: 600; letter-spacing: -0.02em; }
.note { max-width: 60ch; margin-top: 8px; font-size: 14px; line-height: 1.45; color: var(--slate); }

#page > .block-title, #page > .group, #page > .seg, #page > .pickup { margin-left: var(--gutter); margin-right: var(--gutter); }
.group { border-radius: 16px; overflow: hidden; background: var(--surface); }
.group--gap { margin-top: 12px; }
.field { padding: 10px 16px; }
.field + .field { border-top: 1px solid var(--line); }
.field__label { display: block; font-size: 13px; color: var(--slate); }
.field__row { display: flex; align-items: center; gap: 10px; }
.field__input {
  flex: 1; min-width: 0; width: 100%; padding: 4px 0 2px; border: 0; outline: none; background: transparent; resize: none;
  font: 400 17px/1.35 var(--font); color: var(--ink); -webkit-appearance: none; appearance: none;
}
.field__input::placeholder { color: var(--mist); }
.field__aside { flex: none; height: 32px; padding: 0 12px; border-radius: 16px; background: var(--seg); font-size: 14px; font-weight: 600; white-space: nowrap; }
.field__err { display: none; margin-top: 4px; font-size: 13px; color: var(--err); }
.field--err .field__err { display: block; }
.field--err .field__label { color: var(--err); }
.pickup { margin-top: 12px; font-size: 15px; color: var(--slate); }

/* ───── заказ отправлен ───── */
.done { min-height: calc(var(--tg-viewport-stable-height, 100vh) - 140px); display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: 40px var(--gutter); }
.done__mark { width: 64px; height: 64px; fill: none; stroke: var(--ok); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.done__mark circle { stroke-dasharray: 183; stroke-dashoffset: 183; animation: draw .6s ease-out forwards; }
.done__mark path { stroke-dasharray: 42; stroke-dashoffset: 42; animation: draw .35s .5s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.done__title { margin: 22px 0 8px; font-size: 29px; line-height: 1.12; font-weight: 600; letter-spacing: -0.03em; }
.done__sum { margin-bottom: 6px; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.done__text { max-width: 36ch; margin-bottom: 22px; color: var(--slate); }

/* ───── уведомление и запасная кнопка ───── */
#toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 40;
  max-width: 520px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 16px; border-radius: 16px; background: var(--ink); color: var(--paper); font-size: 15px; line-height: 1.35;
  transform: translateY(140%); opacity: 0; pointer-events: none;
  transition: transform .28s cubic-bezier(.2, .8, .2, 1), opacity .2s ease;
}
#toast.on { transform: none; opacity: 1; pointer-events: auto; }
body.with-bar #toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
.toast__act { flex: none; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

#fallback-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
  background: var(--paper); background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
#fallback-main {
  display: block; width: 100%; max-width: 560px; height: 52px; margin: 0 auto; border-radius: 14px;
  background: var(--btn); color: var(--btn-ink); text-align: center; font-size: 17px; font-weight: 600; letter-spacing: -0.01em;
}
#fallback-main:disabled { opacity: .45; cursor: default; }
#fallback-main.busy { opacity: .7; }

/* ───── загрузка ───── */
.sk { border-radius: 12px; background: linear-gradient(90deg, var(--sk1) 25%, var(--sk2) 50%, var(--sk1) 75%); background-size: 200% 100%; animation: sk 1.3s linear infinite; }
.sk--search { flex: 1; height: 44px; border-radius: 14px; }
.sk--word { flex: none; width: 92px; height: 32px; }
.sk--tile { aspect-ratio: 1; border-radius: 22px; }
.sk--line { height: 14px; margin-top: 10px; }
.sk--short { width: 55%; }
.sk--hero { aspect-ratio: 1; border-radius: 0; }
@keyframes sk { to { background-position: -200% 0; } }

@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 640px) {
  .gallery { max-width: 560px; margin: 16px auto 0; }
  .gallery__track { border-radius: 24px; }
  .pp { max-width: 640px; margin: 0 auto; }
}
@media (min-width: 860px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
