/* ============================================================
   Оформление каталога аккаунтов — в том же духе apple.com, что и витрина
   магазина: тёмная тема, карточки со скруглением и мягкой тенью,
   синий — только для действий, тёмные плитки с обложками игр.
   Переменные продублированы здесь, а не подключаются из магазина, чтобы
   каталог одинаково выглядел и как раздел сайта, и при отдельном запуске.
   ============================================================ */

:root {
  color-scheme: dark;

  --bg: #232326;
  --bg-soft: #242427;
  --surface: #19191B;
  --surface-2: #2C2C2F;
  --surface-3: #3A3A3D;
  --line: #424246;
  --line-soft: #2F2F33;
  --text: #F5F5F7;
  --muted: #A1A1A6;
  --muted-2: #86868B;

  --accent: #0071E3;
  --accent-2: #2997FF;
  --accent-hover: #0077ED;
  --accent-soft: rgba(41, 151, 255, 0.14);

  --green: #30D158;
  --amber: #FF9F0A;
  --red: #FF453A;

  --dark: #1D1D1F;
  --gradient-dark: linear-gradient(180deg, #1D1D1F 0%, #000000 100%);

  --radius-card: 18px;
  --radius-card-sm: 12px;
  --radius-card-lg: 28px;
  --radius-pill: 980px;

  /* На тёмном фоне одной тени мало: тонкая светлая кромка отделяет карточку от фона. */
  --shadow-card: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 2px 8px rgba(0, 0, 0, 0.28), 0 8px 24px rgba(0, 0, 0, 0.32);
  --shadow-hover: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.34), 0 16px 40px rgba(0, 0, 0, 0.45);
  --shadow-sm: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 1px 4px rgba(0, 0, 0, 0.24), 0 4px 12px rgba(0, 0, 0, 0.26);

  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

* { box-sizing: border-box; }

/* Как и в магазине: страница не должна ехать вбок из-за шапки. */
html { overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.53;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.08;
}

:focus-visible { outline: 3px solid rgba(0, 113, 227, 0.45); outline-offset: 2px; }

/* ---------------- шапка ---------------- */

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(29, 29, 31, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header__inner {
  width: min(1200px, 100% - 40px);
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.02em;
  white-space: nowrap;
  cursor: pointer;
}

.logo__mark { width: 34px; height: 34px; flex-shrink: 0; }

.nav { display: flex; gap: 2px; margin-left: 10px; }

.nav a {
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  color: var(--text);
  opacity: 0.72;
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.2s var(--ease), background 0.2s var(--ease);
}

.nav a:hover { opacity: 1; }
.nav a.is-active { opacity: 1; background: rgba(255, 255, 255, 0.1); }

.header__side { margin-left: auto; display: flex; align-items: center; gap: 12px; }

/* Кабинет и баланс — те же, что в шапке магазина: на этих страницах покупатель
   должен видеть, что он вошёл, и сколько у него на балансе. */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(280px, 42vw);
  padding: 7px 12px;
  border-radius: 980px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text, #f5f5f7);
  text-decoration: none;
  font-size: 14px;
}

.user-chip:hover { background: rgba(255, 255, 255, 0.14); }

.user-chip__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip__balance {
  flex: none;
  padding: 2px 9px;
  border-radius: 980px;
  background: rgba(48, 209, 88, 0.16);
  color: #30d158;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.user-chip__balance.is-zero {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(245, 245, 247, 0.6);
}

.login-link {
  flex: none;
  padding: 8px 16px;
  border-radius: 980px;
  background: #0071e3;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.login-link:hover { background: #0077ed; }

.cart-link {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 18px;
  transition: background 0.2s var(--ease);
}

.cart-link:hover { background: rgba(255, 255, 255, 0.1); }

.cart-link .count-badge {
  position: absolute;
  top: 1px;
  right: -1px;
  bottom: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  box-shadow: 0 0 0 2px var(--bg);
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.sync-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(48, 209, 88, 0.2); }
.sync-status.stale { color: var(--amber); }
.sync-status.stale .dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(255, 159, 10, 0.2); }

/* ---------------- каркас ---------------- */

.container { width: min(1200px, 100% - 40px); margin: 44px auto 88px; }

.page-title { margin: 0 0 10px; font-size: clamp(30px, 4vw, 48px); font-weight: 700; letter-spacing: -0.03em; }
.page-subtitle { margin: 0 0 36px; color: var(--muted); font-size: clamp(16px, 1.5vw, 19px); letter-spacing: -0.012em; }

.back-link {
  display: inline-flex;
  align-items: center;
  margin-bottom: 16px;
  color: var(--accent-2);
  font-size: 15px;
  cursor: pointer;
}

.back-link:hover { text-decoration: underline; }

.stale-banner {
  padding: 14px 18px;
  margin-bottom: 26px;
  border-radius: var(--radius-card-sm);
  background: rgba(255, 159, 10, 0.14);
  color: #FFB340;
  font-size: 14px;
  line-height: 1.6;
}

/* ---------------- выбор игры ---------------- */

/* auto-fit, а не auto-fill: игр немного, и пустая колонка справа выглядела
   как недогруженная страница. Карточки растягиваются на всю ширину. */
.games-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  max-width: 1080px;
}

.game-card {
  position: relative;
  border-radius: var(--radius-card-lg);
  background: var(--dark);
  color: #fff;
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.game-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }

.game-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  transition: transform 0.7s var(--ease);
}

.game-card:hover img { transform: scale(1.05); }

.game-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.82) 100%);
  pointer-events: none;
}

.game-card .count {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  /* Тёмное стекло, а не светлое: у части обложек (Genshin) белый фон,
     и светлая плашка на нём пропадала. */
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.game-card .label {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 20px;
  z-index: 2;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

/* ---------------- подбор ---------------- */

.game-layout { display: grid; grid-template-columns: 310px 1fr; gap: 28px; align-items: start; }

.filters-panel {
  position: sticky;
  top: 88px;
  padding: 22px;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.filter-group { margin-bottom: 18px; }

.filter-group > label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.filters-panel input,
.filters-panel select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-card-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.filters-panel input::placeholder { color: var(--muted-2); }

.filters-panel input:focus,
.filters-panel select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.16);
}

.range-row { display: flex; align-items: center; gap: 8px; }
.range-row span { color: var(--muted-2); }

/* Переключатель групп — сегментированный контрол, как в iOS. */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 12px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(118, 118, 128, 0.24);
}

.tab-btn {
  flex: 1;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.tab-btn.active { background: #636366; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); font-weight: 600; }

.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  margin-bottom: 18px;
  padding: 8px 10px 6px 6px;
}

.picker-item {
  position: relative;
  padding: 2px;
  border-radius: 12px;
  background: var(--surface-3);
  cursor: pointer;
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}

.picker-item:hover { background: var(--line); transform: translateY(-1px); }

/* Выбранный персонаж должен читаться сразу: толстая синяя рамка, свечение,
   галочка в углу. А остальные, пока что-то выбрано, приглушаются — иначе на
   ярких подложках выбранное теряется в длинном списке. */
.picker-item.selected {
  z-index: 1;
  padding: 3px;
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 113, 227, 0.35), 0 6px 16px rgba(0, 113, 227, 0.35);
  transform: scale(1.06);
}

.picker-item.selected::after {
  content: '✓';
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}

.picker-grid:has(.picker-item.selected) .picker-item:not(.selected) img {
  opacity: 0.45;
  filter: grayscale(0.6);
}

.picker-grid:has(.picker-item.selected) .picker-item:not(.selected):hover img {
  opacity: 0.9;
  filter: none;
}

.picker-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--surface-2);
  object-fit: cover;
  transition: opacity 0.2s var(--ease), filter 0.2s var(--ease);
}

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

.btn {
  flex: 1;
  padding: 11px 18px;
  border: 0;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: background 0.2s var(--ease), transform 0.12s var(--ease);
}

.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary { background: rgba(255, 255, 255, 0.1); color: var(--text); }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.16); }

/* ---------------- выдача ---------------- */

.results-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; min-height: 24px; }

.results-count { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: -0.01em; }

.refresh-hint {
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius-card-sm);
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.refresh-hint:hover { background: rgba(0, 113, 227, 0.14); }

.loading, .empty-state { padding: 72px 20px; text-align: center; color: var(--muted); font-size: 17px; }

.results-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }

.account-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.account-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }

.account-card.special { box-shadow: 0 0 0 2px rgba(0, 113, 227, 0.5), var(--shadow-card); }

.account-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

.account-price {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text);
}

/* Номер аккаунта для заказа. Его покупатель называет менеджеру, поэтому это не
   мелкая подпись в углу, а отдельная плашка прямо над кнопкой заказа: подпись,
   крупный код и кнопка «Скопировать». */
.account-code {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px 10px 16px;
  border-radius: 14px;
  background: var(--surface-2);
}

.account-code__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.account-code__label { color: var(--muted); font-size: 12px; font-weight: 500; }

.account-code__value {
  color: var(--text);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.15;
}

.account-code__copy {
  flex-shrink: 0;
  margin-left: auto;
  padding: 7px 14px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--accent-2);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.account-code__copy:hover { color: var(--accent-hover); }

.account-code__copy.is-done { background: rgba(48, 209, 88, 0.16); color: var(--green); box-shadow: none; }

/* Плашки: у каждого вида свой цвет, чтобы уровень, сервер и тип читались
   с первого взгляда, а не сливались в одну серую ленту. */
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
}

.badge.level { background: var(--text); color: var(--bg); font-weight: 600; }
.badge.server { background: rgba(41, 151, 255, 0.16); color: var(--accent-2); }
.badge.type { background: rgba(191, 90, 242, 0.18); color: #DA8FFF; }
.badge.tag { color: var(--muted); }

/* Иконки персонажей и оружия: крупнее, со скруглением и цветной рамкой.
   Рамка сделана подложкой с отступом, а не border — так градиент получается
   мягким и не режется на углах. */
.item-icons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.item-icon {
  position: relative;
  aspect-ratio: 1;
  padding: 2px;
  border-radius: 16px;
  background: linear-gradient(145deg, #F7D774, #E3A33B);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.item-icon:hover { transform: translateY(-2px) scale(1.04); box-shadow: var(--shadow-hover); z-index: 1; }

.item-icon img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 30%, #4A4A4F, #1D1D1F);
  object-fit: cover;
}

/* Оружие и световые конусы — серебряная рамка: сразу видно, где что. */
.item-icon.weapon { background: linear-gradient(145deg, #E5E7EB, #9CA3AF); }
.item-icon.weapon img { object-fit: contain; background: radial-gradient(circle at 50% 30%, #3F4652, #1D2129); }

/* «+N» — таблетка с обводкой цвета карточки, будто вырезана из рамки. */
.count-badge {
  position: absolute;
  right: -5px;
  bottom: -5px;
  min-width: 22px;
  padding: 1px 6px;
  border: 2px solid var(--surface);
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
}

.account-remark { flex: 1; margin-bottom: 16px; color: var(--muted); font-size: 14px; line-height: 1.55; }

.contact-btn {
  display: block;
  padding: 12px;
  border-radius: var(--radius-pill);
  text-align: center;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: background 0.2s var(--ease), transform 0.12s var(--ease);
}

.contact-btn:hover { background: var(--accent-hover); }
.contact-btn:active { transform: scale(0.98); }

.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 32px; }

.pagination button {
  padding: 9px 20px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: box-shadow 0.2s var(--ease);
}

.pagination button:hover:not(:disabled) { box-shadow: var(--shadow-hover); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.page-info { color: var(--muted); font-size: 14px; }

/* ---------------- подвал ---------------- */

.footer {
  padding: 36px 20px 44px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface);
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.footer a { color: var(--text); }
.footer a:hover { text-decoration: underline; }

/* Документы в подвале раздела — отдельными кнопками, как в магазине. */
.footer-docs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 14px; }

.footer-docs a {
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line-soft);
  color: var(--text);
  font-size: 13px;
  transition: box-shadow 0.2s var(--ease);
}

.footer-docs a:hover { text-decoration: none; box-shadow: inset 0 0 0 1px var(--muted-2); }

/* ---------------- адаптив ---------------- */

/* Меню шапки прячем на той же ширине, что и в магазине, — шапка общая. */
/* Кнопка меню: на широком экране ссылки видны и так. */
.burger {
  display: none;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text, #f5f5f7);
  font-size: 18px;
  cursor: pointer;
}

.burger:hover { background: rgba(255, 255, 255, 0.1); }

@media (max-width: 1067px) {
  .nav { display: none; }
  .burger { display: grid; }
  /* Логотип, кнопка меню, корзина и вход должны уместиться в одну строку:
     сжимаем отступы и даём названию магазина ужиматься многоточием. */
  .header__inner { flex-wrap: wrap; gap: 10px; }
  .logo { min-width: 0; }
  .logo span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .login-link { padding: 7px 13px; }
  /* Время синхронизации — служебная мелочь: на телефоне она выталкивает
     кнопки на вторую строку, а о неактуальности и так предупреждает баннер. */
  .sync-status { display: none; }

  /* Высота шапки фиксированная — под раскрытое меню отпускаем её, иначе
     ссылки лягут поверх страницы. */
  .header__inner:has(.nav.is-open) { height: auto; padding-bottom: 6px; }

  .nav.is-open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    order: 5;
    flex-basis: 100%;
    margin: 12px 0 4px;
  }

  .nav.is-open a {
    padding: 13px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 16px;
  }
}

@media (max-width: 980px) {
  .game-layout { grid-template-columns: 1fr; }
  .filters-panel { position: static; }
}

@media (max-width: 733px) {
  .container { width: calc(100% - 32px); margin-top: 28px; }
  .header__inner { width: calc(100% - 32px); }
  .game-card .label { font-size: 23px; left: 18px; bottom: 16px; }
}

@media (max-width: 560px) {
  .results-grid { grid-template-columns: 1fr; }
  .item-icons { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
  .sync-status { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .game-card, .game-card img, .account-card, .item-icon, .picker-item { transition: none; }
}
