/* Компоненты Nextrax. Служебные (кнопки, поля, бейджи, уведомления, окно) —
   общие с другими нашими сайтами; витрина (шапка, поиск, карточки игр,
   плашка корзины, меню, подвал) — свои, ниже. */
/* ── Кнопки ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 52px; padding: 0 26px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text);
  font-weight: 600; font-size: var(--fs-md); white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost { background: transparent; border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--surface); }
.btn--sm { min-height: 40px; padding: 0 16px; font-size: var(--fs-sm); border-radius: var(--r-xs); }
.btn--lg { min-height: 58px; padding: 0 30px; }
.btn--block { width: 100%; }
.btn.is-loading { pointer-events: none; opacity: 0.7; }
.btn.is-loading::after { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.icon-btn {
  position: relative; display: grid; place-items: center;
  width: 46px; height: 46px; border: 0; border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  transition: background var(--t-fast);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }
.count-badge {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-size: 11px; font-weight: 700; line-height: 20px; text-align: center;
}

/* «Показать все ›» */
.more-link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 16px;
  border-radius: var(--r-sm); background: var(--surface); color: var(--text);
  font-size: var(--fs-sm); font-weight: 500; white-space: nowrap;
  transition: background var(--t-fast);
}
.more-link:hover { background: var(--surface-2); }
.more-link svg { width: 16px; height: 16px; }

/* ── Чипы, бейджи ── */
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted);
  font-size: var(--fs-sm); font-weight: 500; transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip[aria-pressed="true"], .chip.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip__count { opacity: 0.6; font-variant-numeric: tabular-nums; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px;
  border-radius: 999px; background: var(--surface-2); color: var(--text);
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
}
.badge--muted { color: var(--muted); }
.badge--accent { background: var(--accent-soft); color: var(--accent); }
.badge--good { background: rgba(61, 220, 151, 0.12); color: var(--good); }
.badge--done { background: var(--accent); color: var(--accent-ink); }
.badge--warn { background: rgba(245, 184, 75, 0.12); color: var(--warn); }

/* ── Карточки и поверхности ── */
.card { border-radius: var(--r-lg); background: var(--surface); }
.card--pad { padding: clamp(20px, 3vw, 32px); }

/* ── Поля ── */
.field { display: grid; gap: 8px; }
.field__label { font-size: var(--fs-sm); font-weight: 500; color: var(--muted); }
.field__input {
  width: 100%; height: 52px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--bg-2); color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field__input::placeholder { color: var(--faint); }
.field__input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field__hint { font-size: var(--fs-xs); color: var(--faint); }
.form-status { min-height: 1.2em; font-size: var(--fs-sm); color: var(--muted); }
.form-status.is-error { color: var(--bad); }
.form-status.is-success { color: var(--good); }

/* ── Пустые состояния, скелетоны ── */
.empty { display: grid; justify-items: center; gap: 12px; padding: 36px 16px; text-align: center; color: var(--muted); }
.empty svg { width: 34px; height: 34px; color: var(--faint); }
.empty--page { padding: 80px 16px; }
.empty--page h1 { font-size: var(--fs-2xl); color: var(--text); }
.skeleton { border-radius: var(--r-sm); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }

/* ── Уведомления ── */
.toast-region { position: fixed; left: 50%; bottom: 24px; z-index: 400; display: grid; gap: 8px; transform: translateX(-50%); width: min(420px, 100vw - 32px); }
@media (max-width: 760px) { .toast-region { bottom: calc(92px + env(safe-area-inset-bottom)); } }
.toast { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-sm); background: var(--surface-3); box-shadow: var(--shadow); font-size: var(--fs-sm); animation: toast-in var(--t) var(--ease-out); }
.toast::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.toast--success::before { background: var(--good); }
.toast--error::before { background: var(--bad); }
.toast__text { flex: 1; }
.toast__action { border: 0; background: none; color: var(--accent); font-weight: 600; }
.toast.is-leaving { animation: toast-out var(--t) var(--ease-out) forwards; }

/* ── Модальное окно ── */
.modal { position: fixed; inset: 0; z-index: 350; display: grid; place-items: center; padding: 16px; background: rgba(5, 6, 7, 0.7); backdrop-filter: blur(6px); animation: fade-in var(--t); }
.modal__dialog { position: relative; width: min(440px, 100%); padding: 32px 28px 26px; border-radius: var(--r-lg); background: var(--surface); text-align: center; display: grid; gap: 12px; animation: pop-in var(--t) var(--ease-out); }
.modal__icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 4px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); }
.modal__icon svg { width: 26px; height: 26px; }
.modal__dialog p { color: var(--muted); }
.modal__actions { display: grid; gap: 8px; margin-top: 10px; }
.modal__close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); display: grid; place-items: center; }
.modal__close:hover { background: var(--surface-2); }
.modal__close svg { width: 18px; height: 18px; }


/* ═══════════ Фирменное Nextrax ═══════════ */
body { background:
  radial-gradient(900px 420px at 15% -120px, rgba(108, 92, 231, 0.22), transparent 70%),
  radial-gradient(700px 360px at 95% 0, rgba(182, 255, 62, 0.06), transparent 70%),
  var(--bg); }
.page { padding-top: calc(var(--header-h) + 18px); padding-bottom: 40px; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 300; padding: 10px 14px; border-radius: var(--r-xs); background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Шапка ── */
.site-header { position: fixed; inset: 0 0 auto; z-index: 100; height: var(--header-h); background: rgba(12, 10, 24, 0.86); backdrop-filter: blur(16px) saturate(140%); border-bottom: 1px solid var(--line); }
.site-header__inner { height: 100%; display: flex; align-items: center; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.brand__mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: #1a1633; box-shadow: inset 0 0 0 1px var(--line-strong); }
.brand__mark svg { width: 32px; height: 32px; }
.brand__name { font-family: var(--font-display); font-weight: 700; font-size: 1.28rem; letter-spacing: 0.01em; }
.header__nav { display: flex; gap: 4px; }
.header__nav a { padding: 9px 12px; border-radius: var(--r-xs); color: var(--muted); font-weight: 500; font-size: var(--fs-sm); transition: color var(--t-fast), background var(--t-fast); }
.header__nav a:hover, .header__nav a[aria-current="page"] { color: var(--text); background: var(--surface); }
.header__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.header__cart { flex: none; }
.user-chip { display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px 0 5px; border-radius: var(--r-sm); background: var(--surface); }
.user-chip__avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--violet); color: #fff; font-weight: 700; font-size: var(--fs-sm); }
.user-chip__balance { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }

/* поиск в шапке — главный инструмент магазина */
.search { position: relative; flex: 1 1 420px; max-width: 520px; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); color: var(--faint); transition: border-color var(--t-fast); }
.search:focus-within { border-color: var(--accent); }
.search > svg { width: 18px; height: 18px; flex: none; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: var(--text); font: inherit; outline: none; }
.search input::placeholder { color: var(--faint); }
.search__list { position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 5; display: grid; padding: 6px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow); }
.search__item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 7px 8px; border-radius: var(--r-xs); color: var(--text); }
.search__item:hover, .search__item:focus-visible { background: var(--surface-2); }
.search__item img { width: 40px; height: 54px; object-fit: cover; border-radius: 6px; }
.search__item span { display: grid; min-width: 0; }
.search__item strong { font-weight: 600; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search__item small { color: var(--faint); font-size: var(--fs-xs); }
.search__price { color: var(--accent); font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; }
.search__empty { padding: 12px; color: var(--muted); font-size: var(--fs-sm); }

/* ── Карточка игры: обложка 2:3, цена — молния ── */
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 22px 16px; }
.game { display: grid; gap: 10px; color: var(--text); min-width: 0; }
.game__cover { position: relative; display: block; aspect-ratio: 2 / 3; border-radius: var(--r-md); overflow: hidden; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.game__cover img { width: 100%; height: 100%; object-fit: cover; }
.game__cover::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 2px transparent; transition: box-shadow var(--t-fast); }
.game:hover .game__cover::after, .game:focus-visible .game__cover::after { box-shadow: inset 0 0 0 2px var(--accent); }
.game__body { display: grid; gap: 3px; min-width: 0; }
.game__cat { color: var(--faint); font-size: var(--fs-xs); }
.game__title { font-weight: 600; font-size: var(--fs-sm); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.game__price { font-family: var(--font-display); font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.game__price small { font-family: var(--font); font-weight: 500; color: var(--faint); font-size: var(--fs-xs); }
.games--row { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.pdp-similar, .cart-suggest { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1000px) { .games--row { grid-auto-flow: column; grid-auto-columns: 42%; grid-template-columns: none; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; } .games--row .game { scroll-snap-align: start; } }
@media (max-width: 520px) { .games:not(.games--row) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; } }

/* ── Плашка корзины внизу экрана ── */
.cartbar { position: fixed; z-index: 90; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 14px; padding: 8px 8px 8px 12px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line-strong); box-shadow: var(--shadow); color: var(--text); white-space: nowrap; }
.cartbar[hidden] { display: none; }
.cartbar__thumbs { display: flex; }
.cartbar__thumbs img { width: 30px; height: 40px; object-fit: cover; border-radius: 6px; border: 2px solid var(--surface-2); }
.cartbar__thumbs img + img { margin-left: -12px; }
.cartbar__text { font-size: var(--fs-sm); color: var(--muted); }
.cartbar__text strong { color: var(--text); font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.cartbar__go { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 11px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: var(--fs-sm); }
.cartbar__go svg { width: 16px; height: 16px; }

/* ── Нижнее меню (телефон) ── */
.bottom-nav { display: none; }
@media (max-width: 860px) {
  .header__nav { display: none; }
}
@media (max-width: 760px) {
  .site-header__inner { gap: 10px; }
  .brand__name { display: none; }
  .search { flex: 1 1 0; min-width: 0; height: 42px; }
  .header__actions { margin-left: 0; }
  .user-chip__balance { display: none; }
  .user-chip { padding: 0 4px; height: 42px; }
  .header__actions .btn--sm { min-height: 42px; padding: 0 12px; }
  .header__cart { display: none; }
  .bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 95; display: grid; grid-template-columns: repeat(5, 1fr); padding: 0 4px env(safe-area-inset-bottom); background: var(--bg-2); border-top: 1px solid var(--line); }
  .bottom-nav__item { position: relative; display: grid; justify-items: center; align-content: center; gap: 3px; height: 58px; color: var(--faint); font-size: 10.5px; font-weight: 500; }
  .bottom-nav__item svg { width: 22px; height: 22px; }
  .bottom-nav__item[aria-current="page"] { color: var(--accent); }
  .bottom-nav__item .count-badge { top: 6px; right: calc(50% - 20px); min-width: 16px; height: 16px; line-height: 16px; font-size: 10px; padding: 0 4px; }
  body { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  .cartbar { left: 12px; right: 12px; transform: none; bottom: calc(68px + env(safe-area-inset-bottom)); justify-content: space-between; }
}

/* ── Подвал ── */
.site-footer { margin-top: var(--section); border-top: 1px solid var(--line); background: var(--bg-2); }
.site-footer__inner { display: grid; grid-template-columns: 1.3fr repeat(3, 1fr); gap: 32px; padding-block: 44px 28px; }
.site-footer p { color: var(--muted); font-size: var(--fs-sm); max-width: 34ch; margin-top: 12px; }
.site-footer h4 { font-family: var(--font); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin-bottom: 12px; }
.site-footer nav { display: grid; gap: 8px; }
.site-footer nav a { color: var(--muted); font-size: var(--fs-sm); }
.site-footer nav a:hover { color: var(--accent); }
.site-footer__legal { display: grid; gap: 4px; padding-block: 18px 32px; border-top: 1px solid var(--line); color: var(--faint); font-size: var(--fs-xs); }
@media (max-width: 760px) { .site-footer__inner { grid-template-columns: 1fr 1fr; } .site-footer__inner > :first-child { grid-column: 1 / -1; } }

.crumbs { display: flex; align-items: center; gap: 6px; color: var(--faint); font-size: var(--fs-sm); }
.crumbs a:hover { color: var(--text); }
.crumbs svg { width: 14px; height: 14px; }
.tag { display: inline-flex; padding: 4px 10px; border-radius: 6px; background: var(--violet-soft); color: #c7beff; font-size: var(--fs-xs); font-weight: 600; }
.empty-page { display: grid; justify-items: start; gap: 14px; padding-block: 60px; }
.stepper { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border-radius: 10px; background: var(--surface-2); }
.stepper button { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; }
.stepper button:hover:not(:disabled) { background: var(--surface-3); }
.stepper button:disabled { opacity: 0.35; }
.stepper svg { width: 14px; height: 14px; }
.stepper span { min-width: 22px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
@keyframes spin { to { transform: rotate(360deg); } }
