:root {
  --bg: #050308;
  --surface: #0e0a18;
  --surface-2: #151024;
  --line: rgba(140, 100, 255, 0.14);
  --text: #ece8f7;
  --muted: #8d84a8;
  --violet: #8b5cf6;
  --blue: #2cc9ff;
  --grad: linear-gradient(120deg, #8b5cf6, #2cc9ff);
  --glow-violet: 0 0 24px rgba(139, 92, 246, 0.45);
  --glow-blue: 0 0 24px rgba(44, 201, 255, 0.35);
  --radius: 25px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  overflow-x: hidden;
}

/* фоновые неоновые пятна — статичные градиенты, без blur (баг WebView на Windows) */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vw 60vw at -10% -10%, rgba(139, 92, 246, 0.14), transparent 60%),
    radial-gradient(60vw 60vw at 110% 110%, rgba(44, 201, 255, 0.09), transparent 60%);
}

#app { max-width: 520px; margin: 0 auto; min-height: 100vh; padding-bottom: 92px; }

/* ---------- Шапка ---------- */
.header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 18px;
  position: sticky; top: 0; z-index: 10;
  background: #08050e;
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; gap: 12px; align-items: center; }
.logo-mark {
  width: 42px; height: 42px; border-radius: 14px;
  background: var(--grad);
  display: grid; place-items: center;
  font-weight: 800; font-size: 22px; color: #fff;
  box-shadow: var(--glow-violet);
}
.logo-name { font-weight: 700; font-size: 17px; letter-spacing: 0.3px; }
.logo-sub { font-size: 11px; color: var(--muted); font-family: Menlo, Consolas, monospace; }

.balance-chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- Общие ---------- */
main { padding: 16px 18px; animation: pageIn .25s ease; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.section-title {
  font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--muted); font-family: Menlo, Consolas, monospace;
  margin: 22px 2px 10px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.btn {
  display: block; width: 100%;
  padding: 15px;
  border: none; border-radius: 18px;
  font-size: 16px; font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .2s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--glow-violet); }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn-danger { background: rgba(255, 80, 80, 0.12); color: #ff7b7b; border: 1px solid rgba(255,80,80,.25); }

.input {
  width: 100%;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  font-size: 16px;
  outline: none;
}
.input:focus { border-color: var(--violet); box-shadow: var(--glow-violet); }

.empty {
  text-align: center; color: var(--muted);
  padding: 42px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ---------- Главная ---------- */
.hero-card {
  border-radius: var(--radius);
  padding: 24px 20px;
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(139,92,246,.35), transparent 55%),
    radial-gradient(120% 160% at 100% 100%, rgba(44,201,255,.22), transparent 55%),
    var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--glow-violet);
}
.hero-title { font-size: 22px; font-weight: 800; }
.hero-badge {
  display: inline-block; margin-top: 6px;
  font-size: 11px; font-family: Menlo, Consolas, monospace;
  color: #7dffb0;
}
.stat-row { display: flex; gap: 12px; margin-top: 18px; }
.stat {
  flex: 1;
  background: rgba(0,0,0,.35);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}
.stat-value { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Каталог ---------- */
.search-row { display: flex; gap: 10px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}
.chip.active {
  background: var(--grad); color: #fff; border-color: transparent;
  box-shadow: var(--glow-violet);
}

.product-card {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 14px;
  transition: transform .15s ease, box-shadow .25s ease;
}
.product-card:hover { transform: translateY(-2px); box-shadow: var(--glow-blue); }
.product-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.product-title { font-weight: 700; font-size: 16px; }
.product-cat {
  font-size: 11px; color: var(--blue);
  font-family: Menlo, Consolas, monospace;
  border: 1px solid rgba(44,201,255,.3);
  padding: 3px 8px; border-radius: 999px;
  white-space: nowrap;
}
.product-desc { font-size: 14px; color: var(--muted); line-height: 1.45; }
.product-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.price { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.add-btn {
  padding: 10px 18px; border: none; border-radius: 14px;
  background: var(--grad); color: #fff; font-weight: 700; font-size: 14px;
  cursor: pointer; box-shadow: var(--glow-violet);
  transition: transform .12s ease;
}
.add-btn:active { transform: scale(.94); }
.add-btn.in-cart { background: var(--surface-2); box-shadow: none; border: 1px solid var(--line); color: var(--muted); }

/* ---------- Корзина ---------- */
.cart-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
}
.cart-item:last-child { border-bottom: none; }
.cart-remove {
  background: none; border: none; color: #ff7b7b;
  font-size: 20px; cursor: pointer; padding: 4px 10px;
}
.cart-total {
  display: flex; justify-content: space-between;
  font-size: 18px; font-weight: 800;
  padding: 16px 4px 14px;
}

/* ---------- Ключи ---------- */
.key-card { margin-bottom: 12px; }
.key-head { display: flex; justify-content: space-between; align-items: center; }
.key-title { font-weight: 700; }
.key-status { font-size: 11px; font-family: Menlo, Consolas, monospace; color: #7dffb0; }
.key-status.revoked { color: #ff7b7b; }
.key-value {
  margin-top: 10px;
  font-family: Menlo, Consolas, monospace;
  font-size: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  word-break: break-all;
}
.copy-btn {
  background: none; border: none; color: var(--blue);
  font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}

/* ---------- Профиль / история ---------- */
.history-item {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.history-item:last-child { border-bottom: none; }
.history-amount.plus { color: #7dffb0; font-weight: 700; }
.history-amount.minus { color: #ff9d7b; font-weight: 700; }
.history-date { color: var(--muted); font-size: 12px; font-family: Menlo, Consolas, monospace; }

/* ---------- Нижняя навигация ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px;
  display: flex;
  background: #0a0614;
  border-top: 1px solid var(--line);
  padding: 8px 6px 14px;
  z-index: 20;
}
.nav-btn {
  flex: 1;
  background: none; border: none;
  color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px;
  cursor: pointer;
  position: relative;
  padding: 4px 0;
}
.nav-btn svg { width: 22px; height: 22px; fill: currentColor; }
.nav-btn.active { color: var(--violet); }
.nav-btn.active svg { filter: drop-shadow(0 0 6px rgba(139,92,246,.8)); }
.cart-badge {
  position: absolute; top: -2px; right: calc(50% - 22px);
  background: var(--grad);
  color: #fff; font-size: 10px; font-weight: 800;
  border-radius: 999px; padding: 1px 6px;
}

/* ---------- Модалка / тост ---------- */
.modal-backdrop[hidden] { display: none; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(0,0,0,.85);
  display: grid; place-items: end center;
}
.modal-card {
  width: 100%; max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px 28px 0 0;
  padding: 22px 20px 30px;
  animation: sheetUp .25s ease;
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-title { font-size: 18px; font-weight: 800; margin-bottom: 14px; }
.modal-card .btn { margin-top: 10px; }

.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 14px; font-weight: 600;
  box-shadow: var(--glow-violet);
  z-index: 40;
  animation: pageIn .2s ease;
}
.toast.error { border-color: rgba(255,80,80,.4); color: #ff9d9d; }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  50% { transform: translateX(8px); }
  75% { transform: translateX(-4px); }
}
.shake { animation: shake .4s ease; }

/* ---------- Фото товара и подкатегории ---------- */
.product-img {
  width: 100%; max-height: 180px; object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--line);
  display: block;
}
.chip.sub { font-size: 13px; padding: 6px 13px; opacity: .9; }
