/* Нарочно ахроматично: ни одного акцентного цвета, пока палитра не выбрана.
   Тона берём из темы Telegram — в светлой теме это белый, в тёмной
   приложение не будет слепить. Когда появится фирменный цвет, менять
   только переменные ниже. */
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --card: var(--tg-theme-section-bg-color, #ffffff);
  --sunken: var(--tg-theme-secondary-bg-color, #f2f2f4);
  --text: var(--tg-theme-text-color, #14161a);
  --hint: var(--tg-theme-hint-color, #8a8f98);
  --line: color-mix(in srgb, var(--hint) 28%, transparent);
  --radius: 14px;
  --gap: 12px;
}

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

body {
  margin: 0;
  padding: 0 var(--gap) calc(var(--gap) + env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.boot, .empty {
  padding: 48px 8px;
  text-align: center;
  color: var(--hint);
}

/* --- вкладки --- */
.tabs {
  display: flex;
  gap: 4px;
  padding: 10px 0;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}
.tab {
  flex: 1;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: var(--sunken);
  color: var(--hint);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.tab.is-active { color: var(--text); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }

.screen { display: none; }
.screen.is-active { display: block; }

/* --- фильтры --- */
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; }
.chip {
  flex: 0 0 auto;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--hint);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.chip.is-active { color: var(--text); background: var(--sunken); border-color: transparent; }

.search {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: var(--gap);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font: inherit;
}

/* --- сетка карточек --- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
}
@media (min-width: 520px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  font: inherit;
  color: inherit;
}
.tile__shot {
  aspect-ratio: 1;
  width: 100%;
  object-fit: cover;
  background: var(--sunken);
  display: block;
}
.tile__none {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: var(--sunken);
  color: var(--hint);
  font-size: 26px;
}
.tile__body { padding: 9px 10px 11px; display: flex; flex-direction: column; gap: 3px; }
.tile__name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.tile__meta { color: var(--hint); font-size: 12px; }
.tile__price { font-size: 13px; font-weight: 600; }
.tile__flag { color: var(--hint); font-size: 12px; }

/* --- карточка --- */
.screen--card { padding-top: 10px; }
.shots { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 14px; }
.shots img {
  height: 220px;
  border-radius: var(--radius);
  background: var(--sunken);
  flex: 0 0 auto;
}
.card-title { font-size: 21px; margin: 0 0 4px; line-height: 1.25; }
.card-sub { color: var(--hint); margin: 0 0 14px; font-size: 14px; }

.price {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 14px;
}
.price__main { font-size: 17px; font-weight: 600; }
.price__sub, .price__meta { color: var(--hint); font-size: 13px; margin-top: 4px; }
.price__meta a { color: var(--hint); }

.facts { margin: 0 0 14px; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; }
.facts dt { color: var(--hint); font-size: 13px; }
.facts dd { margin: 0; font-size: 14px; }

.note {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  color: var(--hint);
  font-size: 13px;
  margin: 0 0 14px;
}

.actions { display: flex; flex-direction: column; gap: 8px; padding-bottom: 24px; }
.btn {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn--filled { background: var(--sunken); border-color: transparent; }
.btn--quiet { color: var(--hint); font-weight: 400; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

.more {
  display: block;
  width: 100%;
  margin: var(--gap) 0 24px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: transparent;
  color: var(--hint);
  font: inherit;
  cursor: pointer;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: 90%;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  z-index: 50;
}
