:root {
  --bg: #0b0b12;
  --surface: #12121c;
  --surface-2: #1a1a28;
  --border: #26263a;
  --text: #f5f2ea;
  --muted: #9aa0a6;
  --cta: #25c56a;
  --cta-hover: #1fb25c;
  --cta-text: #08120b;
  --gold: #d7b46a;
  --danger: #e0685a;
  --radius: 14px;
  --focus: 2px solid #d7b46a;
  --header-h: 60px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); }

button { font-family: inherit; }

:focus-visible {
  outline: var(--focus);
  outline-offset: 2px;
}

/* ---------- Шапка ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 11, 18, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  min-height: var(--header-h);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 700; letter-spacing: 0.04em; font-size: 18px; }
.brand-sub { color: var(--muted); font-size: 13px; }

.cart-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 48px;
  min-height: 48px;
  justify-content: center;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  padding: 8px 12px;
}
.cart-button:hover { border-color: var(--gold); }
.cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--cta);
  color: var(--cta-text);
  font-size: 12px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ---------- Hero ---------- */
.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 20px 40px;
  text-align: center;
}
.hero-title {
  font-size: 32px;
  line-height: 1.15;
  margin: 0 0 12px;
  font-weight: 700;
}
.hero-sub {
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 20px;
  font-size: 17px;
}
.hero-ladder {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  color: var(--gold);
  font-weight: 500;
  margin: 0 0 24px;
  font-size: 15px;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 28px;
  background: var(--cta);
  color: var(--cta-text);
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}
.cta:hover { background: var(--cta-hover); }
.cta:disabled { opacity: 0.55; cursor: not-allowed; }
.cta.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.cta.ghost:hover { border-color: var(--gold); }

/* ---------- Как это работает ---------- */
.how { max-width: 1200px; margin: 0 auto; padding: 8px 20px 24px; }
.how-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.how-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}
.how-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--gold);
  font-size: 14px;
  font-weight: 700;
}

/* ---------- Каталог ---------- */
.catalog { max-width: 1200px; margin: 0 auto; padding: 16px 20px 96px; }

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.filter-chip {
  min-height: 44px;
  padding: 8px 18px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
}
.filter-chip:hover { border-color: var(--gold); }
.filter-chip.is-active {
  background: var(--gold);
  color: #171310;
  border-color: var(--gold);
  font-weight: 700;
}
.catalog-note { color: var(--muted); min-height: 24px; margin: 0 0 12px; }

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

.skeleton {
  background: linear-gradient(100deg, var(--surface) 40%, var(--surface-2) 50%, var(--surface) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { to { background-position: -200% 0; } }

.catalog-error { text-align: center; padding: 40px 0; color: var(--muted); }

/* ---------- Карточка ---------- */
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-cover {
  position: relative;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.card-cover-number {
  font-size: 56px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}
.card-cover-symbol {
  font-size: 44px;
  color: rgba(255, 255, 255, 0.85);
}
.card-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; flex: 1; }
.card-category { align-self: flex-start; }
.chip {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(215, 180, 106, 0.12);
  border: 1px solid rgba(215, 180, 106, 0.35);
  padding: 3px 10px;
  border-radius: 20px;
}
.card-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}
.card-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-price { font-size: 19px; font-weight: 700; white-space: nowrap; }
.card-price small { font-size: 12px; font-weight: 400; color: var(--muted); }
.card-prices { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-price.old {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  text-decoration: line-through;
}
.card-note {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
}
.card-add {
  min-height: 44px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--cta);
  background: transparent;
  color: var(--cta);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.card-add:hover { background: rgba(37, 197, 106, 0.1); }
.card-add.in-cart {
  border-color: var(--border);
  color: var(--muted);
}
.card-add.in-cart:hover { color: var(--danger); border-color: var(--danger); }

/* ---------- Панель корзины ---------- */
.cart-backdrop, .modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 50;
}
.cart-panel {
  position: fixed;
  z-index: 60;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 86dvh;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  padding-bottom: env(safe-area-inset-bottom);
}
.cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.cart-head h2 { margin: 0; font-size: 20px; }
.cart-body {
  overflow-y: auto;
  padding: 8px 18px;
  flex: 1;
}
.cart-foot {
  border-top: 1px solid var(--border);
  padding: 14px 18px;
}
.icon-button {
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  border-radius: 10px;
}
.icon-button:hover { color: var(--text); background: var(--surface-2); }

.cart-empty { color: var(--muted); padding: 24px 0; text-align: center; }

.cart-lines { list-style: none; margin: 0; padding: 0; }
.cart-line {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.cart-line-info { flex: 1; min-width: 0; }
.cart-line-title { font-weight: 500; font-size: 15px; margin: 0; }
.cart-line-cat { color: var(--muted); font-size: 13px; }
.cart-line-price { font-weight: 700; white-space: nowrap; }
.cart-line-remove {
  min-width: 40px;
  min-height: 40px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  border-radius: 8px;
}
.cart-line-remove:hover { color: var(--danger); }

.cart-summary { padding-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.sum-row { display: flex; justify-content: space-between; font-size: 15px; }
.sum-row.muted { color: var(--muted); }
.sum-row.discount { color: var(--cta); }
.sum-row.total { font-size: 19px; font-weight: 700; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 4px; }
.cart-confirm-note { color: var(--muted); font-size: 13px; }

.progress { margin-top: 12px; }
.progress-text { color: var(--gold); font-size: 14px; margin: 0 0 6px; }
.progress-bar {
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--cta);
  border-radius: 4px;
  transition: width 0.2s ease;
}
.progress-sub { color: var(--muted); font-size: 13px; margin-top: 6px; }

.cart-checkout { width: 100%; margin-top: 4px; }
.share-cart {
  width: 100%;
  margin-top: 10px;
  min-height: 44px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}
.share-cart:hover { border-color: var(--gold); color: var(--text); }

/* ---------- Модалки ---------- */
.modal {
  position: fixed;
  z-index: 60;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 24px);
  max-width: 680px;
  max-height: 92dvh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  background: var(--surface-2);
  border-radius: 50%;
}
.modal-content { overflow-y: auto; padding: 24px 20px; }

.modal-cover { border-radius: 12px; aspect-ratio: 16/9; margin-bottom: 16px; display: flex; align-items: center; justify-content: center; }
.modal-cover .card-cover-number { font-size: 64px; }
.modal-category { margin-bottom: 8px; }
.modal-title { font-size: 22px; margin: 0 0 8px; }
.modal-subtitle { color: var(--muted); margin: 0 0 16px; }
.modal-price-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.modal-price { font-size: 24px; font-weight: 700; }
.modal-next { font-size: 15px; font-weight: 600; color: var(--cta); }
.modal-section { margin-bottom: 18px; }
.modal-section h3 {
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}
.what-inside { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.what-inside li { position: relative; padding-left: 18px; }
.what-inside li::before { content: "—"; position: absolute; left: 0; color: var(--gold); }

.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

/* ---------- Формы ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
}
.field input:focus { outline: var(--focus); border-color: var(--gold); }
.field .error { color: var(--danger); font-size: 13px; margin-top: 4px; }

.checkout-note { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.checkout-total { display: flex; justify-content: space-between; font-size: 18px; font-weight: 700; margin: 6px 0 16px; }

/* ---------- Результат ---------- */
.result-flag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(215, 180, 106, 0.12);
  border: 1px solid rgba(215, 180, 106, 0.35);
  padding: 6px 12px;
  border-radius: 20px;
  margin-bottom: 14px;
}
.result-title { font-size: 22px; margin: 0 0 8px; }
.result-line { color: var(--muted); margin: 0 0 4px; word-break: break-all; }
.result-amount { font-size: 26px; font-weight: 700; margin: 8px 0 16px; }
.payload-block { margin-top: 16px; }
.payload-block summary { cursor: pointer; color: var(--gold); font-weight: 500; }
.payload-code {
  margin-top: 10px;
  background: #08080e;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
  color: #cfd3da;
}
.copy-button {
  margin-top: 12px;
  min-height: 44px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}
.copy-button:hover { border-color: var(--gold); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 90;
  max-width: calc(100% - 32px);
  text-align: center;
}

/* ---------- Debug ---------- */
.debug-bar {
  background: rgba(215, 180, 106, 0.12);
  color: var(--gold);
  font-size: 12px;
  text-align: center;
  padding: 4px 8px;
  border-bottom: 1px solid rgba(215, 180, 106, 0.3);
}

/* ---------- Десктоп ---------- */
@media (min-width: 768px) {
  .hero-title { font-size: 42px; }
  .how-list { flex-direction: row; justify-content: space-between; gap: 16px; }
  .how-list li { flex-direction: column; text-align: center; gap: 8px; flex: 1; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .modal { width: min(680px, calc(100% - 48px)); }
  .modal-actions { flex-direction: row; }

  .cart-panel {
    left: auto;
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    max-height: none;
    border-radius: 0;
    border-left: 1px solid var(--border);
    border-top: none;
  }
}

@media (min-width: 1024px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}
