:root {
  --bg: #10141c;
  --bg-alt: #161b26;
  --card: #1b212e;
  --card-hover: #212838;
  --border: #2a3244;
  --text: #e8ecf3;
  --text-dim: #8b94a7;
  --accent: #ff8a1e;
  --accent-hover: #ff9d40;
  --accent-dim: #3a2a1a;
  --ok: #2fb36a;
  --danger: #e05555;
  --radius: 10px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body.no-scroll { overflow: hidden; }
* { scrollbar-color: var(--border) transparent; }

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; }
button, input, select { font-family: inherit; }

.container { max-width: 1360px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--text-dim); font-size: 14px; }

/* ===== Buttons ===== */
.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-accent { background: var(--accent); color: #1a1206; }
.btn-accent:hover:not(:disabled) { background: var(--accent-hover); }
.btn-block { width: 100%; }
.link-btn { background: none; border: none; color: var(--accent); font-size: 13px; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(16, 20, 28, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 24px; height: 68px; }
.logo { font-weight: 800; font-size: 20px; letter-spacing: 0.5px; white-space: nowrap; }
.logo span { color: var(--accent); }

.search-wrap { position: relative; flex: 1; max-width: 520px; margin: 0; }
.search-input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px 10px 38px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--accent); }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-dim); pointer-events: none; }

.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  max-width: 220px;
  transition: border-color 0.15s;
}
.user-chip:hover { border-color: var(--accent); }
.user-avatar {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #1a1206;
  font-weight: 800;
  font-size: 14px;
  display: grid; place-items: center;
}
.user-email { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cart-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s;
}
.cart-btn:hover { border-color: var(--accent); }
.cart-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  background: var(--accent); color: #1a1206;
  border-radius: 10px; font-size: 12px; font-weight: 800;
}

/* ===== Intro ===== */
.intro { background: linear-gradient(180deg, var(--bg-alt), var(--bg)); border-bottom: 1px solid var(--border); padding: 28px 0; }
.intro-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.intro h1 { font-size: 28px; margin-bottom: 6px; }
.intro p { margin: 0; color: var(--text-dim); font-size: 14px; }
.intro-points { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 13px; color: var(--text-dim); }
.intro-points li::before { content: '✓'; color: var(--accent); margin-right: 8px; font-weight: 700; }

/* ===== Category chips ===== */
.cat-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 18px 0 4px;
  scrollbar-width: thin;
}
.chip {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #1a1206; }
.chip-n { font-size: 11px; font-weight: 600; color: var(--text-dim); margin-left: auto; }
.chip.active .chip-n { color: #4a3210; }

/* ===== Layout ===== */
.main-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 24px;
  padding-top: 20px;
  padding-bottom: 60px;
  align-items: start;
}

.filters {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  scrollbar-width: thin;
}
.filters-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.filters-head h2 { font-size: 16px; }
.filter-block { padding-top: 16px; }
.filter-block h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); margin-bottom: 10px; }

.price-range { display: flex; gap: 8px; }
.price-range input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.price-range input:focus { border-color: var(--accent); }

.check-list { display: grid; gap: 2px; }
.check { display: flex; align-items: center; gap: 8px; padding: 5px 2px; font-size: 13px; cursor: pointer; color: var(--text); }
.check input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; flex-shrink: 0; }
.check span:first-of-type { flex: 1; }
.dot { --rar: #3a4358; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--rar); }

.weapon-list { display: grid; gap: 2px; max-height: 260px; overflow-y: auto; scrollbar-width: thin; }
.weapon-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  text-align: left;
  background: transparent; border: none;
  color: var(--text-dim);
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.weapon-btn:hover { background: var(--card); color: var(--text); }
.weapon-btn.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }

/* ===== Catalog ===== */
.catalog-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.results-count { color: var(--text-dim); font-size: 14px; }
.sort-wrap { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-dim); }
.sort-select {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.filters-toggle { display: none; }

.skins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  transition: opacity 0.15s;
}
.skins-grid.loading { opacity: 0.5; }

.skin-card {
  --rar: #3a4358;
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom: 3px solid var(--rar);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.skin-card:hover { border-color: var(--rar); background: var(--card-hover); transform: translateY(-2px); }

.skin-img-wrap {
  position: relative;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--rar) 22%, #263047) 0%, #171c27 80%);
  border-radius: 8px;
  aspect-ratio: 4 / 3;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  margin-bottom: 10px;
}
.skin-img-wrap img { max-width: 92%; max-height: 92%; object-fit: contain; }
.badges { position: absolute; top: 6px; left: 6px; display: flex; gap: 4px; z-index: 1; }
.badge { font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 4px; background: rgba(0,0,0,0.6); }
.badge.st { color: #ff8a1e; }
.badge.sv { color: #ffd84a; }

.skin-weapon { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skin-name { font-size: 14px; font-weight: 700; line-height: 1.3; margin: 2px 0 4px; min-height: 36px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.skin-wear { font-size: 12px; color: var(--accent); font-weight: 600; min-height: 16px; }
.skin-stock { font-size: 11px; color: var(--text-dim); margin: 2px 0 10px; }
.skin-footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.skin-price { font-size: 16px; font-weight: 800; }

.add-to-cart {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.add-to-cart:hover { background: var(--accent); color: #1a1206; }
.add-to-cart.added { background: var(--ok); color: #fff; }

.no-results { text-align: center; color: var(--text-dim); padding: 60px 0; }
.load-more-wrap { display: flex; justify-content: center; margin-top: 24px; }

/* ===== Account ===== */
.account { padding-top: 32px; padding-bottom: 60px; }
.account h1 { font-size: 28px; margin-bottom: 20px; }
.account-guest { text-align: center; padding: 60px 0; }
.account-guest p { color: var(--text-dim); margin: 0 0 20px; }
.profile-panel { max-width: 460px; margin-bottom: 20px; }
.panel { background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.panel h2 { font-size: 17px; margin-bottom: 16px; }
.profile { display: grid; grid-template-columns: 110px 1fr; gap: 10px 12px; margin: 0 0 20px; font-size: 14px; }
.profile dt { color: var(--text-dim); }
.profile dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.orders-panel .order { border: 1px solid var(--border); border-radius: 8px; background: var(--card); margin-bottom: 12px; overflow: hidden; }
.order-head { display: flex; align-items: center; gap: 14px; padding: 12px 16px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.order-date { color: var(--text-dim); font-size: 13px; }
.order-total { margin-left: auto; color: var(--accent); }
.status { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.st-wait { background: #3a2a1a; color: var(--accent); }
.st-paid { background: #17392a; color: var(--ok); }
.st-cancel { background: #2a2f3d; color: var(--text-dim); }
.order-lines { list-style: none; margin: 0; padding: 6px 16px; }
.order-line { display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 13px; }
.order-line img { width: 52px; height: 39px; object-fit: contain; background: #171c27; border-radius: 5px; flex-shrink: 0; }
.order-line-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-line-sum { color: var(--text-dim); white-space: nowrap; }
.order-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.order-hint { font-size: 12px; color: var(--text-dim); }

/* ===== Forms ===== */
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-dim); }
.form input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
  outline: none;
}
.form input:focus { border-color: var(--accent); }
.form-error { color: var(--danger); font-size: 13px; margin: 0; min-height: 0; }
.form-error:empty, .form-ok:empty { display: none; }
.form-ok { color: var(--ok); font-size: 13px; margin: 0; }
.hint { color: var(--text-dim); font-size: 12px; margin: -6px 0 0; }

/* ===== Modal ===== */
.modal { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); }
.modal-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  max-height: 100%;
  overflow-y: auto;
}
.modal-card h2 { font-size: 22px; margin-bottom: 14px; }
.modal-close { position: absolute; top: 14px; right: 14px; background: none; border: none; color: var(--text-dim); font-size: 18px; cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal-note { background: var(--accent-dim); color: var(--accent); border-radius: 8px; padding: 10px 12px; font-size: 13px; margin: 0 0 14px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--card); padding: 4px; border-radius: 9px; margin-bottom: 18px; }
.tab { background: none; border: none; color: var(--text-dim); padding: 9px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; }
.tab.active { background: var(--accent); color: #1a1206; }

/* ===== Cart drawer ===== */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 90; }
.overlay.open { opacity: 1; pointer-events: auto; }
.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 400px; max-width: 94vw;
  background: var(--bg-alt);
  border-left: 1px solid var(--border);
  z-index: 100;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  visibility: hidden;
}
.cart-drawer.open { transform: translateX(0); visibility: visible; }
.cart-header { display: flex; align-items: center; justify-content: space-between; padding: 20px; border-bottom: 1px solid var(--border); }
.cart-header h2 { font-size: 18px; }
.cart-close { background: none; border: none; color: var(--text-dim); font-size: 18px; cursor: pointer; line-height: 1; }
.cart-close:hover { color: var(--text); }
.cart-items { flex: 1; overflow-y: auto; padding: 8px 20px; }
.cart-empty { color: var(--text-dim); text-align: center; padding: 40px 0; font-size: 14px; }
.cart-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cart-item.gone { opacity: 0.55; }
.cart-item-img { width: 68px; height: 51px; background: #171c27; border-radius: 6px; display: grid; place-items: center; flex-shrink: 0; }
.cart-item-img img { max-width: 92%; max-height: 92%; object-fit: contain; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 13px; font-weight: 600; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-item-price { font-size: 13px; color: var(--accent); font-weight: 700; }
.cart-item-controls { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.qty-btn { width: 24px; height: 24px; border-radius: 5px; border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; font-size: 14px; line-height: 1; }
.qty-btn:hover { border-color: var(--accent); }
.qty-val { font-size: 13px; min-width: 18px; text-align: center; }
.remove-item { margin-left: auto; background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 13px; }
.remove-item:hover { color: var(--danger); }
.cart-footer { padding: 16px 20px 20px; border-top: 1px solid var(--border); }
.cart-total-row { display: flex; justify-content: space-between; align-items: center; font-size: 15px; margin-bottom: 14px; }
.cart-total-row strong { font-size: 20px; color: var(--accent); }
.cart-note { font-size: 12px; color: var(--text-dim); text-align: center; margin: 10px 0 0; }

/* ===== Toast / Footer ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--card);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  max-width: 90vw;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.footer { border-top: 1px solid var(--border); padding: 20px 0; color: var(--text-dim); font-size: 13px; text-align: center; }

/* ===== Responsive ===== */
@media (max-width: 960px) {
  .main-layout { grid-template-columns: 1fr; }
  .filters { position: static; max-height: none; display: none; }
  .filters.open { display: block; }
  .filters-toggle { display: inline-block; }
  .intro-points { display: none; }
}

@media (max-width: 700px) {
  .container { padding: 0 14px; }
  .header-inner { gap: 10px; height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
  .search-wrap { order: 3; flex-basis: 100%; max-width: none; }
  .cart-label, .user-email { display: none; }
  .user-chip { padding: 4px; }
  .header-register { display: none; }
  .intro h1 { font-size: 22px; }
  .skins-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .skin-footer { flex-direction: column; align-items: stretch; }
  .add-to-cart { width: 100%; }
  .sort-wrap { font-size: 0; gap: 0; }
  .order-total { margin-left: 0; }
  .modal-card { padding: 22px; }
}
