/* Витрина клуба. Цвета берём у Telegram — витрина должна выглядеть частью
   клиента, а не чужой страницей внутри него. */
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --fg: var(--tg-theme-text-color, #0f0f0f);
  --muted: var(--tg-theme-hint-color, #8b8b8b);
  --card: var(--tg-theme-secondary-bg-color, #f4f4f5);
  --accent: var(--tg-theme-button-color, #d92d20);
  --accent-fg: var(--tg-theme-button-text-color, #ffffff);
  --line: color-mix(in srgb, var(--muted) 25%, transparent);
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: 32px;
  -webkit-tap-highlight-color: transparent;
}

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.bar {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 12px 16px 8px;
}

.mark { font-weight: 700; letter-spacing: 0.08em; }
.total { color: var(--muted); font-size: 13px; }

.find { display: block; padding: 0 16px 10px; }

.find input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  -webkit-appearance: none;
  appearance: none;
}
.find input::placeholder { color: var(--muted); }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 10px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 12px 16px;
}
@media (min-width: 560px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}

.card {
  padding: 0;
  /* Карточка цвета фона с тонкой рамкой: на серой заливке фото «плавают». */
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-align: left;
  color: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.card .shot {
  /* Родная пропорция складских снимков — 960×1280. Квадрат резал треть кадра. */
  aspect-ratio: 3 / 4;
  width: 100%;
  /* contain, а не cover: складское фото 3:4 заполняет рамку целиком, а
     студийный снимок поставщика — широкий, и обрезать его по бокам нельзя. */
  object-fit: contain;
  background: #fff;
  display: block;
}

.card .body { padding: 8px 10px 10px; display: grid; gap: 3px; }
.card .name {
  font-size: 13px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .brand { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.price { font-weight: 600; font-size: 14px; }
.attr { font-size: 11.5px; color: var(--muted); }
.was { color: var(--muted); text-decoration: line-through; font-weight: 400; font-size: 12px; margin-left: 6px; }
.tag {
  position: absolute;
  margin: 8px;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 999px;
  font-size: 11px;
  padding: 2px 8px;
}
.card .wrap { position: relative; }

.state { color: var(--muted); text-align: center; padding: 32px 24px; margin: 0; }
.more { display: flex; justify-content: center; padding: 4px 16px 20px; }

.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 14px;
  cursor: pointer;
}

/* Карточка товара */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--bg);
  overflow-y: auto;
  padding-bottom: 28px;
}

.shots {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.shots::-webkit-scrollbar { display: none; }
.shots img {
  flex: 0 0 100%;
  scroll-snap-align: center;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  background: #fff;
}

.dots { display: flex; gap: 5px; justify-content: center; padding: 8px 0 0; }
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--line); }
.dot[data-on="1"] { background: var(--muted); }

.detail { padding: 14px 16px 0; display: grid; gap: 10px; }
.detail h2 { margin: 0; font-size: 19px; line-height: 1.25; }
.attrs { color: var(--muted); font-size: 13px; }
.big { font-size: 24px; font-weight: 700; }
.defect {
  background: var(--card);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
}
.actions { display: grid; gap: 8px; padding: 16px 16px 0; }

.primary {
  border: 0;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.primary[disabled] { opacity: 0.5; }

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 20px;
  z-index: 20;
  background: var(--fg);
  color: var(--bg);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  text-align: center;
}
