:root {
  --bg: #0f1115;
  --panel: #161a20;
  --panel-2: #1d232c;
  --text: #e7ebf0;
  --muted: #9aa7b2;
  --brand: #0ea5ff;
  --accent: #2563eb;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.app { min-height: 100%; display: flex; flex-direction: column; }

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  margin: 0 8px 0;
  background: #0c0f13;
  border-bottom: 1px solid #0f141b;
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  z-index: 60;
}

.user { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: #2a2f37; object-fit: cover;
}
.name { font-weight: 600; font-size: 15px; }
.balance { display: flex; align-items: center; gap: 10px; }
.balance .amount { padding: 8px 12px; background: #0d1218; border-radius: 12px; color: #a8c1d8; font-size: 13px; }
.primary { background: #0e7dd8; color: white; border: none; border-radius: 14px; padding: 10px 16px; font-weight: 600; font-size: 14px; }

.filters {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg);
  margin-top: 80px;
}

.filter-btn {
  flex: 1;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn.active {
  background: rgba(14, 125, 216, 0.15);
  border-color: rgba(14, 125, 216, 0.3);
  color: #0e7dd8;
}

.filter-btn:hover {
  background: var(--panel-2);
}

.content {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 12px;
  /* запас под фиксированную нижнюю панель */
  padding-bottom: 110px;
  /* без отступа сверху, т.к. filters уже с margin-top */
  padding-top: 12px;
}

.card {
  background: var(--panel);
  border-radius: 16px;
  padding: 10px;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 8px;
  position: relative;
}

.thumb { width: 100%; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; background: var(--panel-2); display:flex; align-items:center; justify-content:center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.meta { display: grid; gap: 4px; padding-right: 56px; }
.title { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price { font-weight: 700; }
.buy { position: absolute; right: 10px; bottom: 10px; background: #0b5bd7; border:none; border-radius: 12px; width: 42px; height: 42px; display:flex; align-items:center; justify-content:center; }
.buy img { width: 22px; height: 22px; object-fit: contain; }

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #0c0f13;
  border-top: 1px solid #0f141b;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 14px 12px calc(14px + env(safe-area-inset-bottom));
  gap: 10px;
  z-index: 50;
  margin: 0 8px;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}
.tab { background: #0d1218; border-radius: 18px; padding: 12px 8px; text-align: center; color: #a5b4c3; font-size: 13px; display:flex; flex-direction: column; align-items:center; gap: 6px; }
.tab.active { color: #fff; background: #0e7dd8; }
.tab-icon { width: 22px; height: 22px; object-fit: contain; }
.tab-label { line-height: 1; }

/* footer удалён */

@media (min-width: 540px) {
  .content { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 720px) {
  .content { grid-template-columns: repeat(4, 1fr); }
}

