/* Публичная галерея билдов — мобильная вёрстка */
.bg-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 12px calc(20px + env(safe-area-inset-bottom, 0px));
}

.bg-intro {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--tg-muted);
  line-height: 1.45;
}

.bg-search {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 12px;
  border-radius: 10px;
  border: 1px solid var(--tg-bubble-border);
  background: var(--tg-bubble);
  color: var(--tg-text);
  font-size: 16px;
  outline: none;
}

.bg-search:focus {
  border-color: var(--tg-accent);
}

.bg-hero-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 520px) {
  .bg-hero-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.bg-hero-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: var(--tg-bubble);
  color: inherit;
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.bg-hero-card:active {
  opacity: 0.92;
}

.bg-hero-card__thumb {
  aspect-ratio: 1;
  background: #0a0010;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.bg-hero-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bg-hero-card__ph {
  font-size: 28px;
  font-weight: 700;
  color: var(--tg-muted);
}

.bg-hero-card__body {
  padding: 8px 10px 10px;
}

.bg-hero-card__name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--tg-text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bg-hero-card__meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--tg-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.bg-char-tier {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  border-radius: 5px;
  border: 1.5px solid;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.bg-char-tier--trainer { color: #3fb950; border-color: #3fb950; }

.bg-build-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.bg-build-item {
  border-radius: 12px;
  overflow: hidden;
  background: var(--tg-bubble);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.bg-build-item__card-link {
  display: block;
  color: inherit;
}

.bg-build-item__actions {
  padding: 0 12px 12px;
}

.bg-build-lab-btn {
  display: block;
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid rgba(103, 58, 183, 0.55);
  background: linear-gradient(135deg, rgba(103, 58, 183, 0.35), rgba(3, 233, 244, 0.12));
  color: var(--tg-accent);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  letter-spacing: 0.02em;
  -webkit-tap-highlight-color: transparent;
}

.bg-build-lab-btn:active {
  opacity: 0.88;
}

.bg-build-item__img {
  width: 100%;
  height: auto;
  display: block;
  background: #0a0010;
}

.bg-build-item__cap {
  padding: 10px 12px 12px;
  font-size: 14px;
  line-height: 1.4;
}

body.bg-gallery-detail .tg-topbar__back {
  display: flex;
  align-items: center;
  justify-content: center;
}

.bg-back-link {
  display: inline-block;
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--tg-bubble);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--tg-accent);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.bg-back-link:active {
  opacity: 0.85;
}

.bg-intro--hero {
  margin-top: 0;
}

.bg-build-item__line1 {
  font-weight: 600;
  color: var(--tg-accent);
}

.bg-build-item__note {
  margin-top: 8px;
  color: var(--tg-text);
  white-space: pre-wrap;
  word-break: break-word;
}

.bg-build-item__note--empty {
  color: var(--tg-muted);
}

.bg-empty,
.bg-loading,
.bg-error {
  text-align: center;
  padding: 40px 16px;
  color: var(--tg-muted);
  font-size: 15px;
}

.bg-error {
  color: #e57373;
}
