/* ============================================================
   NOIR MARKET — чёрно-белый стиль
   ============================================================ */

:root {
  --bg: #050505;
  --bg-soft: #0b0b0b;
  --card: #101010;
  --card-2: #161616;
  --line: #262626;
  --line-soft: #1c1c1c;
  --txt: #f5f5f5;
  --muted: #8f8f8f;
  --dim: #5a5a5a;
  --acc: #ffffff;
  --danger: #ffffff;
  --radius: 18px;
  --radius-sm: 12px;
  --nav-h: 64px;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-text: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* ═══ LIQUID GLASS ═══ */
  --glass-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.03),
      inset 1.8px 3px 0px -2px rgba(255, 255, 255, 0.27),
      inset -2px -2px 0px -2px rgba(255, 255, 255, 0.24),
      inset -3px -8px 1px -6px rgba(255, 255, 255, 0.18),
      inset -0.3px -1px 4px 0px rgba(0, 0, 0, 0.24),
      inset -1.5px 2.5px 0px -2px rgba(0, 0, 0, 0.4),
      inset 0px 3px 4px -2px rgba(0, 0, 0, 0.4),
      inset 2px -6.5px 1px -4px rgba(0, 0, 0, 0.2),
      0px 1px 5px 0px rgba(0, 0, 0, 0.2),
      0px 6px 16px 0px rgba(0, 0, 0, 0.16);
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-bg-elev: rgba(255, 255, 255, 0.1);
  --glass-filter: blur(18px) saturate(150%);
  --glass-filter-heavy: blur(28px) saturate(160%);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font-text);
  font-size: 15px;
  line-height: 1.45;
  overscroll-behavior: none;
}

body { user-select: none; -webkit-user-select: none; }

#app { max-width: 560px; margin: 0 auto; min-height: 100%; position: relative; }

.hidden { display: none !important; }

::-webkit-scrollbar { width: 0; height: 0; }

/* ---------- Шапка ---------- */

#topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
  background: linear-gradient(to bottom, var(--bg) 75%, transparent);
  backdrop-filter: blur(12px);
}

.brand { display: flex; align-items: center; gap: 11px; }

.brand-mark {
  width: 40px; height: 40px; border-radius: 13px;
  background: var(--acc); color: #000;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 1px var(--line);
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700; font-size: 17px; letter-spacing: 0.08em;
}

.brand-tag {
  font-size: 10.5px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.14em;
}

.topbar-btn {
  width: 40px; height: 40px; border-radius: 13px;
  background: var(--card); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform .15s, background .15s;
}
.topbar-btn:active { transform: scale(0.92); background: var(--card-2); }

/* ---------- Бегущая строка ---------- */

.marquee {
  overflow: hidden; white-space: nowrap;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 7px 0; margin-bottom: 4px;
}

.marquee-track {
  display: inline-block;
  animation: marquee 22s linear infinite;
  font-family: var(--font-display);
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted);
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------- Поиск ---------- */

.search-bar { padding: 4px 16px 10px; }

.search-inner {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 14px;
}

.search-inner input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--txt); font-family: var(--font-text); font-size: 15px;
}
.search-inner input::placeholder { color: var(--dim); }

.search-clear {
  background: none; border: none; color: var(--muted);
  font-size: 15px; cursor: pointer; padding: 2px 6px;
}

/* ---------- Экраны ---------- */

#views { padding-bottom: calc(var(--nav-h) + 28px); }

.view { display: none; padding: 4px 16px 0; animation: fadeUp .25s ease; }
.view.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-title {
  font-family: var(--font-display);
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted);
  margin: 22px 2px 12px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }

/* ---------- Категории ---------- */

.chips {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 2px 2px 4px; scrollbar-width: none;
}

.chip {
  flex-shrink: 0; display: flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--txt); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .18s; white-space: nowrap;
}
.chip .count { color: var(--dim); font-size: 11.5px; }
.chip.active { background: var(--acc); color: #000; border-color: var(--acc); }
.chip.active .count { color: #555; }
.chip:active { transform: scale(0.95); }

/* ---------- Сетка товаров ---------- */

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.p-card {
  position: relative;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
  cursor: pointer; overflow: hidden;
  transition: transform .16s, border-color .16s;
  display: flex; flex-direction: column; gap: 10px;
}
.p-card:active { transform: scale(0.97); border-color: #3d3d3d; }

.p-icon {
  width: 52px; height: 52px; border-radius: 16px;
  background: var(--bg-soft); border: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: center;
}

.p-badge {
  position: absolute; top: 12px; right: 12px;
  background: var(--acc); color: #000;
  font-family: var(--font-display);
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em;
  padding: 4px 8px; border-radius: 7px; text-transform: uppercase;
}

.p-name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.p-sub { font-size: 11.5px; color: var(--muted); line-height: 1.35; min-height: 30px; }

.p-bottom { display: flex; align-items: baseline; gap: 7px; margin-top: auto; }
.p-price { font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.p-old { font-size: 12px; color: var(--dim); text-decoration: line-through; }

.p-stock { font-size: 10.5px; color: var(--dim); letter-spacing: 0.04em; }
.p-stock.out { color: var(--muted); font-weight: 600; }

/* ---------- Кнопки ---------- */

.btn {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; padding: 15px 18px;
  background: var(--acc); color: #000;
  border: none; border-radius: 14px;
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
  letter-spacing: 0.06em; text-transform: uppercase;
  cursor: pointer; transition: transform .15s, opacity .15s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; pointer-events: none; }

.btn-ghost {
  background: transparent; color: var(--txt);
  border: 1px solid var(--line);
}

.btn-sm {
  width: auto; padding: 9px 14px; font-size: 11.5px; border-radius: 10px;
}

.btn-row { display: flex; gap: 9px; }
.btn-row .btn { flex: 1; }

/* ---------- Шторка (bottom sheet) ---------- */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,0.72); backdrop-filter: blur(3px);
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
  max-width: 560px; margin: 0 auto;
  background: var(--bg-soft);
  border: 1px solid var(--line); border-bottom: none;
  border-radius: 24px 24px 0 0;
  max-height: 88vh; display: flex; flex-direction: column;
  animation: slideUp .28s cubic-bezier(.22,.9,.3,1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.sheet-grip {
  width: 42px; height: 4px; border-radius: 4px;
  background: var(--line); margin: 10px auto 2px; flex-shrink: 0;
}

.sheet-content { overflow-y: auto; padding: 14px 18px calc(20px + env(safe-area-inset-bottom)); }

.sheet-title {
  font-family: var(--font-display); font-weight: 700; font-size: 19px;
  margin-bottom: 4px; letter-spacing: 0.01em;
}

/* ---------- Карточка товара в шторке ---------- */

.pd-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.pd-icon {
  width: 68px; height: 68px; border-radius: 20px; flex-shrink: 0;
  background: var(--card); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
}
.pd-cat { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 3px; }

.pd-price-row { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 14px; }
.pd-price { font-family: var(--font-display); font-weight: 700; font-size: 26px; }
.pd-old { color: var(--dim); text-decoration: line-through; font-size: 15px; }
.pd-save {
  background: var(--acc); color: #000; font-size: 10.5px; font-weight: 700;
  padding: 3px 8px; border-radius: 6px; letter-spacing: 0.05em;
}

.pd-desc {
  font-size: 13.5px; color: #c9c9c9; line-height: 1.55;
  white-space: pre-line; margin-bottom: 16px;
  border-top: 1px solid var(--line-soft); padding-top: 14px;
}

.qty-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 12px; margin-bottom: 12px;
}
.qty-controls { display: flex; align-items: center; gap: 16px; }
.qty-btn {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--card-2); border: 1px solid var(--line);
  color: var(--txt); font-size: 17px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.qty-val { font-family: var(--font-display); font-weight: 700; font-size: 17px; min-width: 22px; text-align: center; }

/* ---------- Корзина ---------- */

.cart-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; margin-bottom: 9px;
}
.ci-icon {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
  background: var(--bg-soft); border: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: center;
}
.ci-info { flex: 1; min-width: 0; }
.ci-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-price { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.ci-actions { display: flex; align-items: center; gap: 10px; }
.ci-qty { font-family: var(--font-display); font-weight: 600; font-size: 14px; min-width: 16px; text-align: center; }
.ci-btn {
  width: 28px; height: 28px; border-radius: 9px;
  background: var(--card-2); border: 1px solid var(--line);
  color: var(--txt); cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}

.promo-row { display: flex; gap: 8px; margin: 14px 0; }
.promo-row input {
  flex: 1; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; color: var(--txt);
  font-family: var(--font-mono); font-size: 13px; text-transform: uppercase; outline: none;
}
.promo-row input:focus { border-color: #444; }

.totals {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px;
}
.t-row { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--muted); padding: 3px 0; }
.t-row.total { color: var(--txt); font-family: var(--font-display); font-weight: 700; font-size: 18px; padding-top: 8px; margin-top: 6px; border-top: 1px dashed var(--line); }

/* ---------- Профиль ---------- */

.profile-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-top: 8px;
}
.avatar {
  width: 56px; height: 56px; border-radius: 18px;
  background: var(--acc); color: #000;
  font-family: var(--font-display); font-weight: 700; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.profile-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.order-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
}
.oc-head { display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.oc-id { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.oc-total { font-family: var(--font-display); font-weight: 700; }
.oc-items { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.5; }

.status {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  padding: 4px 9px; border-radius: 7px; text-transform: uppercase;
}
.status.paid { background: var(--acc); color: #000; }
.status.pending { border: 1px solid var(--line); color: var(--muted); }
.status.expired { border: 1px solid var(--line-soft); color: var(--dim); text-decoration: line-through; }

.delivery-box {
  margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px;
}
.dl-name { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.dl-key {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bg); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 6px;
  font-family: var(--font-mono); font-size: 12px;
  word-break: break-all; user-select: text; -webkit-user-select: text;
  white-space: pre-line;
}
.dl-copy {
  flex-shrink: 0; background: var(--card-2); border: 1px solid var(--line);
  border-radius: 8px; width: 30px; height: 30px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Пустые состояния ---------- */

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 56px 20px; text-align: center; color: var(--muted);
}
.empty-icon {
  width: 84px; height: 84px; border-radius: 26px;
  background: var(--card); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  opacity: 0.85;
}
.empty-title { font-family: var(--font-display); font-weight: 600; font-size: 16px; color: var(--txt); }
.empty-text { font-size: 13px; max-width: 260px; }

/* ---------- Нижняя навигация ---------- */

#bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  max-width: 560px; margin: 0 auto;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(5,5,5,0.88); backdrop-filter: blur(18px);
  border-top: 1px solid var(--line-soft);
  display: flex; align-items: stretch;
}

.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  background: none; border: none; cursor: pointer;
  color: var(--dim); position: relative;
  transition: color .15s;
}
.nav-item span { font-size: 9.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; font-family: var(--font-display); }
.nav-item.active { color: var(--txt); }
.nav-item .ic { opacity: 0.55; transition: opacity .15s; }
.nav-item.active .ic { opacity: 1; }

.nav-dot {
  position: absolute; top: 8px; right: calc(50% - 16px);
  min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--acc); color: #000; border-radius: 9px;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Тосты ---------- */

#toasts {
  position: fixed; top: 14px; left: 0; right: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; padding: 0 16px;
}

.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--acc); color: #000;
  border-radius: 13px; padding: 11px 16px;
  font-size: 13px; font-weight: 600;
  max-width: 100%;
  animation: toastIn .25s cubic-bezier(.2,.9,.3,1.2);
  box-shadow: 0 8px 30px rgba(0,0,0,0.6);
}
.toast.dark { background: var(--card-2); color: var(--txt); border: 1px solid var(--line); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(.95); } to { opacity: 1; transform: none; } }
.toast.out { animation: toastOut .2s forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* ---------- Сплэш ---------- */

#splash {
  position: fixed; inset: 0; z-index: 300;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px;
  transition: opacity .4s;
}
#splash.done { opacity: 0; pointer-events: none; }

.splash-logo {
  font-family: var(--font-display); font-weight: 700;
  font-size: 24px; letter-spacing: 0.28em;
}
.splash-logo span { margin: 0 4px; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.2; } }

.splash-bar {
  width: 160px; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden;
}
.splash-bar i {
  display: block; height: 100%; width: 40%;
  background: var(--acc);
  animation: loadbar 1.1s ease-in-out infinite;
}
@keyframes loadbar { 0% { transform: translateX(-100%); } 100% { transform: translateX(400%); } }

/* ---------- Фатальный экран ---------- */

#fatal {
  position: fixed; inset: 0; z-index: 250; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 30px; text-align: center;
}
.fatal-title { font-family: var(--font-display); font-weight: 700; font-size: 20px; }
.fatal-text { color: var(--muted); font-size: 14px; max-width: 300px; }

/* ---------- Скелетоны ---------- */

.skeleton {
  background: linear-gradient(100deg, var(--card) 40%, var(--card-2) 50%, var(--card) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: var(--radius); border: 1px solid var(--line-soft);
}
@keyframes shimmer { to { background-position: -200% 0; } }
.sk-card { height: 170px; }

/* ---------- Формы ---------- */

.field { margin-bottom: 13px; }
.field label {
  display: block; font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 6px;
}
.field input, .field textarea, .field select {
  width: 100%; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px;
  color: var(--txt); font-family: var(--font-text); font-size: 14px; outline: none;
  transition: border-color .15s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: #4a4a4a; }
.field textarea { resize: vertical; min-height: 84px; font-family: var(--font-mono); font-size: 12.5px; }
.field select { appearance: none; }
.field .hint { font-size: 11px; color: var(--dim); margin-top: 5px; line-height: 1.4; }

.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 13px;
}
.switch-row span { font-size: 13.5px; font-weight: 500; }

.switch { position: relative; width: 46px; height: 26px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--card-2); border: 1px solid var(--line); transition: .2s;
}
.switch i::before {
  content: ''; position: absolute; width: 18px; height: 18px;
  left: 3px; top: 3px; border-radius: 50%;
  background: var(--muted); transition: .2s;
}
.switch input:checked + i { background: var(--acc); border-color: var(--acc); }
.switch input:checked + i::before { transform: translateX(20px); background: #000; }

/* ---------- Админ ---------- */

.admin-tabs {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 8px 2px 12px; scrollbar-width: none;
  position: sticky; top: 62px; z-index: 30;
  background: var(--bg);
}

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px;
}
.stat-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; display: flex; align-items: center; gap: 6px; }
.stat-value { font-family: var(--font-display); font-weight: 700; font-size: 23px; margin-top: 7px; }
.stat-sub { font-size: 11px; color: var(--dim); margin-top: 2px; }

.admin-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 9px;
}
.ar-icon {
  width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0;
  background: var(--bg-soft); border: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: center;
}
.ar-main { flex: 1; min-width: 0; }
.ar-title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ar-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.ar-side { text-align: right; flex-shrink: 0; }
.ar-actions { display: flex; gap: 7px; flex-shrink: 0; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 11px;
  background: var(--card-2); border: 1px solid var(--line);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform .12s;
}
.icon-btn:active { transform: scale(0.9); }

.inactive-row { opacity: 0.45; }

.icon-preview {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1px dashed var(--line);
  border-radius: 12px; padding: 10px 12px; margin-top: 7px;
}
.icon-preview .txt { font-size: 11px; color: var(--dim); }

.add-fab {
  position: fixed; right: max(16px, calc(50% - 264px));
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
  z-index: 45;
  width: 54px; height: 54px; border-radius: 18px;
  background: var(--acc); color: #000; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 28px rgba(255,255,255,0.14);
  transition: transform .15s;
}
.add-fab:active { transform: scale(0.9); }

/* ---------- Оплата / успех ---------- */

.pay-wait { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 22px 6px; text-align: center; }
.spinner {
  width: 52px; height: 52px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--acc);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.success-burst {
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--acc); color: #000;
  display: flex; align-items: center; justify-content: center;
  animation: pop .45s cubic-bezier(.2,1.4,.4,1);
}
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }

.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; }

@media (min-width: 561px) {
  #app { border-left: 1px solid var(--line-soft); border-right: 1px solid var(--line-soft); }
}

/* ============================================================
   LIQUID GLASS — стеклянный слой поверх ч/б темы
   Рецепт --glass-shadow как в getgems v2. Backdrop-blur только
   на плавающих элементах (шапка, навигация, шторка, тосты) —
   карточкам в потоке хватает полупрозрачности и inset-бликов,
   так WebView не проседает по FPS.
   ============================================================ */

/* ---------- шапка: стекло над прокруткой ---------- */

#topbar {
  background: rgba(5, 5, 5, 0.55);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
}

.topbar-btn,
.search-inner {
  background: var(--glass-bg);
  border-color: transparent;
  box-shadow: var(--glass-shadow);
}

/* ---------- чипы категорий ---------- */

.chip {
  background: var(--glass-bg);
  border-color: transparent;
  box-shadow: var(--glass-shadow);
}
.chip.active {
  background: var(--acc);
  border-color: var(--acc);
}

/* липкая полоса админ-табов — контент проезжает под стеклом */
.admin-tabs {
  background: rgba(5, 5, 5, 0.6);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
}

/* ---------- карточки и плашки ---------- */

.p-card,
.cart-item,
.order-card,
.profile-card,
.stat-card,
.admin-row,
.totals,
.qty-row,
.switch-row,
.icon-preview,
.empty-icon {
  background: var(--glass-bg);
  border-color: rgba(255, 255, 255, 0.04);
  box-shadow: var(--glass-shadow);
}

/* внутренние «камешки» с иконками */
.p-icon,
.pd-icon,
.ci-icon,
.ar-icon {
  background: rgba(255, 255, 255, 0.05);
  border-color: transparent;
  box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.03),
      inset 1px 1px 0 0 rgba(255, 255, 255, 0.12),
      inset -1px -1px 0 0 rgba(255, 255, 255, 0.06);
}

/* ---------- кнопки и поля ввода ---------- */

.btn:not(.btn-ghost) {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.btn-ghost,
.qty-btn,
.ci-btn,
.icon-btn,
.dl-copy,
.dl-key,
.promo-row input,
.field input,
.field textarea,
.field select {
  background: var(--glass-bg);
  border-color: transparent;
  box-shadow: var(--glass-shadow);
}
.qty-btn:active,
.ci-btn:active,
.icon-btn:active {
  background: var(--glass-bg-elev);
}

/* ---------- шторка: тяжёлое стекло ---------- */

.sheet {
  background: rgba(12, 12, 14, 0.72);
  border-color: rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: var(--glass-filter-heavy);
  backdrop-filter: var(--glass-filter-heavy);
  box-shadow: var(--glass-shadow), 0 -10px 40px rgba(0, 0, 0, 0.4);
}

.sheet-backdrop {
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* ---------- тосты ---------- */

.toast.dark {
  background: rgba(24, 24, 26, 0.6);
  border-color: transparent;
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  box-shadow: var(--glass-shadow);
}

/* ---------- нижняя навигация: плавающая стеклянная пилюля ---------- */

#bottomnav {
  left: 12px;
  right: 12px;
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  max-width: 536px;
  height: var(--nav-h);
  padding: 5px;
  gap: 4px;
  border-top: none;
  border-radius: 999px;
  background: rgba(10, 10, 12, 0.5);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  box-shadow: var(--glass-shadow);
}

.nav-item {
  border-radius: 999px;
}
.nav-item.active {
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.03),
      inset 1px 1px 0 0 rgba(255, 255, 255, 0.15),
      inset -1px -1px 0 0 rgba(255, 255, 255, 0.1),
      0 2px 4px rgba(0, 0, 0, 0.15);
}

/* плавающая навигация стала выше — сдвигаем контент и FAB */
#views {
  padding-bottom: calc(var(--nav-h) + 48px);
}
.add-fab {
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 30px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5), var(--glass-shadow);
}

/* ============================================================
   МАРКЕТПЛЕЙС: отзывы, чаты, кабинет продавца, избранное
   ============================================================ */

/* ---------- рейтинг и избранное на карточках ---------- */

.p-rating {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11.5px; font-weight: 600; color: var(--txt);
  margin-left: auto;
}
.p-rating .muted { font-weight: 400; }

.p-fav {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 30px; height: 30px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform .15s;
}
.p-fav:active { transform: scale(0.85); }
.p-fav.on { background: rgba(255, 90, 118, 0.12); border-color: rgba(255, 90, 118, 0.35); }

.pd-fav { position: static; margin-left: auto; flex-shrink: 0; width: 36px; height: 36px; }

.p-card { position: relative; }
.p-card .p-badge + .p-fav { top: 10px; }

.p-seller {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--muted); margin-top: 3px;
}

.pd-stars { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.stars { display: inline-flex; gap: 1px; }

/* ---------- строка продавца в шторке ---------- */

.seller-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 11px 13px;
  margin-bottom: 12px; cursor: pointer;
  transition: background .15s;
}
.seller-row:active { background: var(--card-2); }

/* ---------- отзывы ---------- */

.review {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 11px 13px; margin-bottom: 8px;
}
.rv-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.rv-name { font-weight: 600; font-size: 13px; }
.rv-text { font-size: 13.5px; color: var(--txt); white-space: pre-wrap; }
.rv-reply {
  margin-top: 8px; padding: 8px 10px;
  background: var(--card-2); border-radius: 9px;
  font-size: 12.5px; color: var(--muted);
}
.rv-reply b { color: var(--txt); font-weight: 600; }
.rv-reply-btn {
  margin-top: 7px; background: none; border: none;
  color: var(--muted); font-size: 12px; text-decoration: underline;
  cursor: pointer; padding: 0;
}

.rate-picker { display: flex; justify-content: center; gap: 8px; }
.rate-star {
  background: none; border: none; cursor: pointer; padding: 4px;
  transition: transform .12s;
}
.rate-star:active { transform: scale(1.25); }

/* ---------- чаты ---------- */

.chat-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 12px 13px; margin-bottom: 8px;
  cursor: pointer; transition: background .15s;
}
.chat-item:active { background: var(--card-2); }
.chat-item .ar-sub {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 230px;
}

.chat-top {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 0 12px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 10px;
}

.chat-log {
  display: flex; flex-direction: column; gap: 7px;
  min-height: 45vh; max-height: 58vh; overflow-y: auto;
  padding: 6px 2px;
}

.msg {
  max-width: 78%; padding: 9px 12px; border-radius: 15px;
  font-size: 14px; line-height: 1.4; word-break: break-word;
  white-space: pre-wrap; position: relative;
}
.msg.mine {
  align-self: flex-end;
  background: var(--acc); color: #000;
  border-bottom-right-radius: 5px;
}
.msg.their {
  align-self: flex-start;
  background: var(--card-2); color: var(--txt);
  border: 1px solid var(--line-soft);
  border-bottom-left-radius: 5px;
}
.msg-time {
  display: inline-block; margin-left: 8px;
  font-size: 10px; opacity: 0.55; vertical-align: bottom;
}

.chat-input {
  display: flex; gap: 8px; align-items: center;
  position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 20px);
  padding-top: 10px;
}
.chat-input input {
  flex: 1; height: 46px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--txt); padding: 0 15px; font-size: 14.5px;
  font-family: var(--font-text); outline: none;
}
.chat-input input:focus { border-color: #3a3a3a; }
.chat-send {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
  background: var(--acc); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
.chat-send:active { transform: scale(0.9); }

/* ---------- бейдж продавца в админке ---------- */

.seller-badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--acc); color: #000;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px;
  vertical-align: middle; margin-left: 4px;
}

/* ---------- игры: сетка, страница, редактор ---------- */

.games-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 16px;
}

.g-card {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: var(--radius); overflow: hidden;
  cursor: pointer; transition: transform .15s, border-color .15s;
}
.g-card:active { transform: scale(0.97); border-color: var(--line); }

.g-photo {
  width: 100%; aspect-ratio: 16 / 9;
  background: var(--card-2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.g-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.g-info { padding: 9px 12px 11px; }
.g-name { font-weight: 600; font-size: 13.5px; font-family: var(--font-display); }
.g-count { font-size: 11px; color: var(--muted); margin-top: 2px; }

.game-hero {
  position: relative; min-height: 104px;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line-soft); background: var(--card);
  display: flex; align-items: flex-end;
  margin-bottom: 12px;
}
.game-hero-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0.55;
}
.game-hero-in {
  position: relative; width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  background: linear-gradient(to top, rgba(5,5,5,.88), rgba(5,5,5,.25) 70%, transparent);
}
.game-hero-name { font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.game-hero-sub { font-size: 12px; color: var(--muted); }

.g-thumb {
  width: 46px; height: 46px; border-radius: 11px; overflow: hidden;
  background: var(--card-2); border: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.g-thumb img { width: 100%; height: 100%; object-fit: cover; }

.game-photo-preview {
  width: 100%; aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  background: var(--card-2); border: 1px dashed var(--line);
  display: flex; align-items: center; justify-content: center;
  text-align: center; overflow: hidden; margin-bottom: 8px;
}
.game-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
