/* Кольори — з теми Telegram (themeParams → CSS-змінні від telegram-web-app.js), з запасними значеннями для браузера. */
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #1f1f1f);
  --hint: var(--tg-theme-hint-color, #8a8a8a);
  --card: var(--tg-theme-secondary-bg-color, #f3f3f5);
  --accent: var(--tg-theme-button-color, #2aabee);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --link: var(--tg-theme-link-color, #2a7fd4);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
body { padding: 12px 12px calc(88px + env(safe-area-inset-bottom)); }
.top h1 { font-size: 20px; margin: 4px 2px 4px; }
.hint { color: var(--hint); margin: 0 2px 12px; font-size: 13px; }
.center { text-align: center; }
.small { font-size: 12px; margin-top: 14px; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--card); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column;
  cursor: pointer; -webkit-tap-highlight-color: transparent; }
.tile img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: #fff; display: block; }
.tile .body { padding: 8px 9px 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.tile h3 { font-size: 13.5px; line-height: 1.25; margin: 0; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; }
.tile .short { font-size: 12px; color: var(--hint); margin: 0; display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden; }
.price { font-weight: 600; margin: 2px 0 0; }
.tile .price { font-size: 13.5px; margin-top: auto; padding-top: 4px; }

.add { border: 1.5px solid var(--accent); background: transparent; color: var(--accent); border-radius: 10px;
  font: inherit; font-size: 13px; font-weight: 600; padding: 7px 6px; cursor: pointer; }
.add.on { background: var(--accent); color: var(--accent-text); }
.add.big { width: 100%; padding: 12px; font-size: 15px; margin-top: 12px; }

.sheet { position: fixed; inset: 0; z-index: 10; }
.sheet[hidden] { display: none; }
.backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto; background: var(--bg);
  border-radius: 18px 18px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); }
.panel img { width: 100%; max-height: 42vh; object-fit: contain; background: #fff; border-radius: 12px; display: block; }
.panel h2 { font-size: 18px; margin: 12px 0 4px; }
.panel .text { white-space: pre-line; margin: 10px 0; }
.footer { color: var(--hint); font-size: 13px; padding-left: 18px; margin: 8px 0; }
.link { color: var(--link); font-size: 14px; }
.close { position: absolute; right: 14px; top: 12px; z-index: 1; border: 0; border-radius: 50%; width: 32px; height: 32px;
  background: var(--card); color: var(--text); font-size: 16px; cursor: pointer; }

/* Поза Telegram (перегляд у браузері) — своя кнопка замість MainButton. */
.fallback { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 5;
  border: 0; border-radius: 12px; padding: 14px; background: var(--accent); color: var(--accent-text);
  font: inherit; font-weight: 600; cursor: pointer; }
.fallback[hidden] { display: none; }
