/* StoreApp — каталог городских приложений.
   Оформление под мобильное приложение: нижние вкладки, карусели с прокруткой,
   крупная витрина. Без библиотек — только CSS-переменные, grid и flex. */

:root {
  color-scheme: light dark;

  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eceff3;
  --text: #0b0f16;
  --text-dim: #6b7787;
  --line: #e6e9ee;
  --accent: #0f7d8c;
  --accent-2: #22c1b5;
  --accent-soft: #e2f4f4;
  --on-accent: #ffffff;
  --shadow-sm: 0 1px 2px rgba(11, 15, 22, 0.05);
  --shadow: 0 6px 24px rgba(11, 15, 22, 0.09);
  --nav-h: 62px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0d12;
    --surface: #141a22;
    --surface-2: #1d242e;
    --text: #eef1f5;
    --text-dim: #93a0b1;
    --line: #232b36;
    --accent: #2fd4c4;
    --accent-2: #4ee0b8;
    --accent-soft: #0f2d2c;
    --on-accent: #04231f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  }
}

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

html, body { overscroll-behavior-y: none; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; }

.wrap {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 0 18px;
}

[hidden] { display: none !important; }

/* ── Шапка ────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  transition: border-color 0.2s;
  border-bottom: 1px solid transparent;
}

.topbar.is-stuck { border-bottom-color: var(--line); }

.topbar__inner {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--text-dim);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-btn:active { transform: scale(0.94); }

/* Поиск всегда прижат вправо, даже когда слева пусто. */
.icon-btn--right { margin-left: auto; }

.topbar__title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Короткое пояснение на главной, вместо прежнего крупного заголовка. */
.lead {
  margin: 14px 0 4px;
  color: var(--text-dim);
  font-size: 14.5px;
}

/* ── Поиск ────────────────────────────────────────────────────────────── */
.search {
  position: relative;
  display: block;
  margin: 14px 0 4px;
}

.search input {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 40px;
  border-radius: 13px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.search input:focus {
  border-color: var(--accent);
  background: var(--surface);
}

.search__icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

/* ── Секции и карусели ────────────────────────────────────────────────── */
.section { margin-top: 26px; }

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section__head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.section__more {
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

/* Горизонтальная лента с прилипанием — как в сторах. */
.rail {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  margin: 0 -18px;
  padding: 2px 18px 6px;
  /* Без этого прилипание тянет первый элемент к самому краю экрана
     и съедает отступ слева: лента прокручивается сама на 18 пикселей. */
  scroll-padding-inline: 18px;
}

.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; flex: 0 0 auto; }

/* ── Витрина ──────────────────────────────────────────────────────────── */
.promo {
  width: min(86vw, 520px);
  border-radius: 24px;
  padding: 20px;
  color: #fff;
  background: linear-gradient(150deg, var(--promo-a, #0f7d8c), var(--promo-b, #22c1b5));
  box-shadow: var(--shadow);
  display: block;
  position: relative;
  overflow: hidden;
  min-height: 180px;
}

.promo::after {
  content: '';
  position: absolute;
  right: -40px;
  bottom: -60px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
}

.promo__kicker {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  opacity: 0.85;
}

.promo__row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  position: relative;
}

.promo__icon {
  width: 68px;
  height: 68px;
  border-radius: 17px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.15);
}

.promo__name {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.02em;
}

.promo__tagline {
  margin: 3px 0 0;
  opacity: 0.9;
  font-size: 14px;
}

.promo__btn {
  position: relative;
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: #10202a;
  font-weight: 700;
  font-size: 14px;
}

/* ── Плитка в ленте ───────────────────────────────────────────────────── */
.tile {
  width: 128px;
  text-align: center;
}

.tile__icon {
  width: 128px;
  height: 128px;
  border-radius: 28px;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.tile__name {
  margin-top: 9px;
  font-weight: 650;
  font-size: 14px;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile__sub {
  color: var(--text-dim);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Строка списка ────────────────────────────────────────────────────── */
.row {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 13px;
  align-items: center;
  padding: 11px 0;
}

.row + .row { border-top: 1px solid var(--line); }

.row__icon {
  width: 60px;
  height: 60px;
  border-radius: 15px;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.row__name {
  font-weight: 650;
  letter-spacing: -0.01em;
}

.row__sub {
  color: var(--text-dim);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row__meta {
  margin-top: 5px;
  display: flex;
  gap: 6px;
}

.pill {
  height: 32px;
  padding: 0 18px;
  border-radius: 999px;
  border: none;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.pill:active { transform: scale(0.96); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}

.badge--done {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}

/* Вышла новая версия — метка заметнее, чем спокойное «установлено». */
.badge--new {
  background: #f0a200;
  color: #1b1200;
}

/* ── Категории ────────────────────────────────────────────────────────── */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -18px 6px;
  padding: 2px 18px 8px;
  scroll-padding-inline: 18px;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.chip[aria-selected='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* ── Экран приложения ─────────────────────────────────────────────────── */
.detail__hero {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 16px;
  align-items: center;
  padding: 18px 0 4px;
}

.detail__icon {
  width: 96px;
  height: 96px;
  border-radius: 23px;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.detail__name {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.detail__dev {
  margin: 4px 0 0;
  color: var(--accent);
  font-weight: 600;
  font-size: 13.5px;
}

.specs {
  display: flex;
  gap: 0;
  margin: 20px -18px 0;
  padding: 0 18px;
  overflow-x: auto;
  scrollbar-width: none;
}

.specs::-webkit-scrollbar { display: none; }

.spec {
  flex: 1 0 auto;
  min-width: 76px;
  text-align: center;
  padding: 0 10px;
  white-space: nowrap;
}

.spec + .spec { border-left: 1px solid var(--line); }

.spec__label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  margin-bottom: 3px;
}

.spec__value { font-weight: 700; font-size: 15px; }

.shots {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  margin: 0 -18px;
  padding: 0 18px 4px;
  scroll-padding-inline: 18px;
}

.shots::-webkit-scrollbar { display: none; }

.shots img {
  flex: 0 0 auto;
  width: 168px;
  border-radius: 16px;
  border: 1px solid var(--line);
  scroll-snap-align: start;
  background: var(--surface-2);
  box-shadow: var(--shadow-sm);
}

.prose { line-height: 1.65; color: var(--text-dim); }
.prose h3 { color: var(--text); font-size: 17px; margin: 24px 0 9px; letter-spacing: -0.02em; }

.list { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }

.list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--text-dim);
}

.list li::before {
  content: '';
  width: 6px;
  height: 6px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: var(--on-accent);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.btn:active { transform: scale(0.985); }

.btn--ghost {
  background: var(--surface-2);
  color: var(--text);
  flex: 0 0 auto;
  padding: 0 18px;
}

/* Главная кнопка карточки — во всю ширину под характеристиками,
   как в магазинах приложений. */
.btn--install {
  width: 100%;
  height: 48px;
  margin: 20px 0 22px;
  font-size: 16px;
  border-radius: 14px;
}

/* Приложение уже стоит на телефоне: место кнопки занимает спокойная
   надпись — нажимать нечего, но пустоты в вёрстке не появляется. */
.btn--done {
  background: none;
  border: 1px solid var(--line);
  color: var(--text-dim);
  cursor: default;
}

.btn--done:active { transform: none; }

/* ── Выбор платформы в окне установки ─────────────────────────────────── */
.options { display: grid; gap: 10px; margin-top: 16px; }

.option {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 13px 15px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.option:active { transform: scale(0.99); }

.option__icon {
  display: grid;
  place-items: center;
  width: 26px;
  color: var(--accent);
}
.option__text { flex: 1; display: grid; }
.option__text b { font-size: 15px; }
.option__text span { color: var(--text-dim); font-size: 13px; }
.option__go { color: var(--text-dim); font-size: 22px; line-height: 1; }

.sheet__note { color: var(--text-dim); margin: 0; font-size: 14px; }
/* ── Полоска обновления ───────────────────────────────────────────────── */
.updatebar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 14px;
  animation: rise 0.24s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.updatebar span {
  flex: 1;
  min-width: 0;
}

.updatebar__close {
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  padding: 0 2px;
}

/* Короткое сообщение вроде «Ссылка скопирована»: гаснет само, нажимать
   нечего, поэтому события мыши сквозь него проходят. */
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom, 0px));
  z-index: 45;
  max-width: calc(100% - 36px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow);
  pointer-events: none;
}

/* Предложение включить уведомления — внизу главной, чтобы не лезло вперёд
   самого каталога. */
.pushbox {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.pushbox { margin-bottom: 18px; }
.pushbox__text { flex: 1; min-width: 0; display: grid; gap: 3px; }
.pushbox__text b { font-size: 15px; }
.pushbox__text span { color: var(--text-dim); font-size: 13px; }

/* ── Нижние вкладки ───────────────────────────────────────────────────── */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--line);
}

.tab {
  flex: 1;
  border: none;
  background: none;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.tab[aria-selected='true'] { color: var(--accent); }
.tab:active { transform: scale(0.95); }

/* ── Нижнее окно ──────────────────────────────────────────────────────── */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: end center;
  background: rgba(6, 10, 16, 0.55);
}

.sheet__card {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 20px 20px calc(26px + env(safe-area-inset-bottom, 0px));
  animation: rise 0.24s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes rise {
  from { transform: translateY(26px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (min-width: 620px) {
  .sheet { place-items: center; }
  .sheet__card { border-radius: 24px; }
}

.sheet__grip {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: -6px auto 14px;
}

.sheet h3 { margin: 0 0 6px; font-size: 19px; letter-spacing: -0.02em; }

.steps {
  counter-reset: step;
  margin: 16px 0 18px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 13px;
}

/* Именно flex, а не grid: в grid каждый кусок текста внутри <li> стал бы
   отдельной ячейкой, и строка разъезжалась бы вокруг выделенных слов. */
.steps li {
  counter-increment: step;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  color: var(--text-dim);
}

.steps li::before {
  content: counter(step);
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  display: grid;
  place-items: center;
}

.steps b { color: var(--text); }

.empty { text-align: center; padding: 50px 20px; color: var(--text-dim); }

/* Появление экрана: лёгкий сдвиг, как при переходе в приложении. */
.view { animation: slide 0.22s ease-out; }

@keyframes slide {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .view, .sheet__card { animation: none; }
}


/* Предложение включить уведомления при открытии установленного каталога. */
.pushoffer {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-radius: 18px;
  background: #11161f;
  color: #eef2f7;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .34);
}

.pushoffer__text { flex: 1; min-width: 0; line-height: 1.35 }
.pushoffer__text b { display: block; font-size: 14.5px }
.pushoffer__text span { font-size: 12.5px; color: #9fabb9 }

.pushoffer .pill { flex: none }

.pushoffer__close {
  flex: none;
  border: 0;
  background: none;
  color: #8b95a3;
  font-size: 15px;
  padding: 4px 2px;
  cursor: pointer;
}
