/* Цвета берём у Telegram: приложение должно выглядеть частью клиента,
   а не белой страницей в тёмной теме. Значения после запятой — на случай
   старого клиента, который темы не отдаёт. */
:root {
  --bg:     var(--tg-theme-bg-color, #17212b);
  --fg:     var(--tg-theme-text-color, #ffffff);
  --hint:   var(--tg-theme-hint-color, #7d8b99);
  --card:   var(--tg-theme-secondary-bg-color, #232e3c);
  --accent: var(--tg-theme-button-color, #5288c1);
}

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

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

.bar {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 14px 14px 6px;
}
.bar h1 { margin: 0; font-size: 20px; font-weight: 600; }
.subtitle { color: var(--hint); font-size: 13px; }

/* Плитка. minmax(140px) — три колонки на большом телефоне, две на маленьком. */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 8px 14px 20px;
}

.card {
  position: relative;
  background: var(--card);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .12s ease;
}
.card:active { transform: scale(.97); }

/* Портрет вертикальный, а лицо у верхней трети кадра — поэтому кроп сверху. */
.card img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center 18%;
  background: rgba(127, 127, 127, .18);
}

.card .noface {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 3 / 4;
  font-size: 34px;
  color: var(--hint);
  background: rgba(127, 127, 127, .18);
}

.cap { padding: 8px 10px 10px; }
.name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge { display: block; margin-top: 2px; font-size: 11px; color: var(--hint); }

/* Кнопка «прочие действия»: основной тап уходит в съёмку, а карточка модели
   со всеми правками остаётся доступна отсюда. */
.more {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  font-size: 15px;
  line-height: 30px;
  backdrop-filter: blur(4px);
}
.more:active { background: rgba(0, 0, 0, .7); }

.note {
  padding: 40px 24px;
  text-align: center;
  color: var(--hint);
}
.note b { display: block; margin-bottom: 6px; color: var(--fg); font-size: 16px; }

.skeleton {
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  background: var(--card);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .45; } }
