:root {
  --bg: #0b0d12;
  --bg-2: #101319;
  --surface: #15181f;
  --surface-2: #1c212b;
  --border: #282e3a;
  --text: #e9ebf1;
  --muted: #8b91a2;
  --faint: #5b6273;
  /* Фирменное золото Titan */
  --accent: #e2c150;
  --accent-2: #f3d878;
  --accent-deep: #b6902f;
  --accent-glow: rgba(226, 193, 80, 0.22);
  --green: #46cf7c;
  --amber: #e0a93a;
  --red: #ef5a70;
  --purple: #7f9cc9;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, 'Roboto', 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Consolas', 'SF Mono', ui-monospace, monospace;
  font-family: var(--font);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1000px 520px at 82% -8%, rgba(226, 193, 80, 0.06) 0%, transparent 60%),
    radial-gradient(1100px 600px at 12% -10%, #171a22 0%, var(--bg) 55%);
  color: var(--text);
  font-feature-settings: 'tnum' 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
svg { display: block; }
.ic { width: 18px; height: 18px; flex-shrink: 0; }
.hidden { display: none !important; }
a { color: inherit; text-decoration: none; cursor: pointer; }
button { font-family: inherit; }

/* ---------- Кнопки ---------- */
.btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.btn:hover { border-color: var(--accent); background: #232833; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); border-color: var(--accent); color: #16130a; font-weight: 700; }
.btn-primary:hover { background: linear-gradient(180deg, var(--accent-2), var(--accent-deep)); box-shadow: 0 6px 18px var(--accent-glow); border-color: var(--accent-2); }
.btn-primary svg { color: #16130a; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--red); border-color: rgba(239, 90, 112, 0.25); }
.btn-danger:hover { background: rgba(239, 90, 112, 0.12); border-color: var(--red); }
.btn-sm { padding: 6px 10px; font-size: 0.82rem; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 7px; }

/* ---------- Формы ---------- */
input, select, textarea {
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.9rem;
  width: 100%;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
label { display: block; font-size: 0.82rem; color: var(--muted); margin: 12px 0 5px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > div { flex: 1; min-width: 140px; }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 36px 32px; width: 100%; max-width: 380px; box-shadow: var(--shadow);
}
.login-logo-img { width: 96px; height: 96px; object-fit: contain; display: block; margin: 0 auto 14px; }
.login-logo { font-size: 1.55rem; font-weight: 800; text-align: center; letter-spacing: -0.01em; }
.login-logo span { color: var(--accent); }
.login-sub { text-align: center; color: var(--muted); font-size: 0.85rem; margin: 6px 0 22px; }
.login-error { color: var(--red); font-size: 0.85rem; margin-top: 12px; text-align: center; min-height: 18px; }
.login-card .btn { margin-top: 20px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; height: 100vh; overflow: hidden; }
.sidebar {
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-right: 1px solid var(--border);
  padding: 22px 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px 22px; }
.brand-logo { width: 38px; height: 38px; object-fit: contain; flex-shrink: 0; }
.brand-text { font-size: 1.12rem; font-weight: 800; line-height: 1.05; letter-spacing: -0.01em; }
.brand-text span { color: var(--accent); }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 600; font-size: 0.92rem; transition: all 0.15s;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: #16130a; box-shadow: 0 4px 14px var(--accent-glow); }
.nav-item.active .ic { color: #16130a; }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.whoami { font-size: 0.82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 28px; border-bottom: 1px solid var(--border); flex-shrink: 0;
  background: var(--bg); z-index: 20;
}
.topbar h1 { font-size: 1.3rem; margin: 0; }
.topbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.view-root { padding: 24px 28px; flex: 1; min-height: 0; overflow-y: auto; }

/* ---------- Карточки статистики ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; position: relative; overflow: hidden;
}
.stat-card::after {
  content: ''; position: absolute; right: -20px; top: -20px; width: 90px; height: 90px;
  border-radius: 50%; background: var(--accent-glow); filter: blur(24px); opacity: 0.5;
}
.stat-label { color: var(--muted); font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 2rem; font-weight: 800; margin-top: 6px; }
.stat-sub { font-size: 0.82rem; color: var(--faint); margin-top: 4px; }
.stat-value.green { color: var(--green); }
.stat-value.amber { color: var(--amber); }
.stat-value.accent { color: var(--accent-2); }
.stat-value.purple { color: var(--purple); }

/* ---------- Панели ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-title { font-size: 1rem; font-weight: 700; margin: 0; }
.panel-sub { color: var(--muted); font-size: 0.85rem; margin: 2px 0 0; }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; }
@media (max-width: 1000px) {
  .grid-2 { grid-template-columns: 1fr; }
  .app { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .sidebar { position: static; height: auto; }
  .main { height: auto; overflow: visible; }
  .view-root { overflow-y: visible; }
  .parser-layout { height: auto; }
  .parser-catalog .cards-scroll { overflow: visible; }
}

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
tbody tr:hover { background: var(--surface-2); }
td .row-actions { display: flex; gap: 6px; }
.mono { font-family: var(--font-mono); font-size: 0.82rem; color: var(--accent-2); }

/* ---------- Бейджи ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px;
  font-size: 0.76rem; font-weight: 700; border: 1px solid transparent;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.active { color: var(--green); background: rgba(67, 209, 122, 0.12); }
.badge.paused { color: var(--amber); background: rgba(245, 181, 68, 0.12); }
.badge.revoked { color: var(--red); background: rgba(247, 87, 110, 0.12); }
.badge.success { color: var(--green); background: rgba(67, 209, 122, 0.12); }
.badge.error { color: var(--red); background: rgba(247, 87, 110, 0.12); }
.badge.running, .badge.queued { color: var(--accent-2); background: rgba(122, 162, 247, 0.12); }
.badge.stopped { color: var(--muted); background: rgba(139, 147, 169, 0.12); }
.badge.current { color: var(--accent); background: rgba(226, 193, 80, 0.14); }

/* ---------- Товары ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 14px; align-items: stretch; }
.game-card { position: relative; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; display: flex; flex-direction: column; transition: border-color 0.15s, box-shadow 0.15s; cursor: pointer; }
.game-card:hover { border-color: #3a4150; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); }
.game-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--bg-2); }
.game-card .gc-body { padding: 10px 11px 11px; display: flex; flex-direction: column; flex: 1; }
/* Название — всегда 2 строки (резервируем высоту), чтобы цены выравнивались по ряду. */
.gc-title { font-size: 0.82rem; font-weight: 600; line-height: 1.3; margin: 0 0 8px; min-height: 2.6em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Подвал — колонка на всю оставшуюся высоту: цена сверху, платформы прижаты к низу. */
.gc-foot { display: flex; flex-direction: column; flex: 1; }
.gc-priceline { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.gc-price { color: var(--text); font-size: 0.98rem; font-weight: 800; letter-spacing: -0.01em; }
.gc-rating { color: var(--amber); font-size: 0.74rem; font-weight: 700; white-space: nowrap; }
.gc-saleline { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.gc-old { color: var(--faint); text-decoration: line-through; font-size: 0.74rem; }
.gc-disc { color: var(--green); font-size: 0.7rem; font-weight: 700; background: rgba(70, 207, 124, 0.12); padding: 1px 5px; border-radius: 4px; }

/* PS Plus — единый аккуратный блок (плашка), а не россыпь строк. */
.gc-plus-box { margin-top: 8px; padding: 6px 8px; border-radius: 7px; background: rgba(226, 193, 80, 0.07); border: 1px solid rgba(226, 193, 80, 0.22); border-left: 3px solid var(--accent); }
.gc-plus-row { display: flex; align-items: center; gap: 6px; font-size: 0.86rem; }
.gc-plus-row b { color: var(--accent); font-weight: 800; }
.gc-plus-disc { color: var(--green); font-size: 0.7rem; font-weight: 800; margin-left: auto; }
.gc-plus-cap { margin-top: 4px; font-size: 0.68rem; font-weight: 600; color: var(--accent-2); line-height: 1.25; }
.gc-plus-ends { margin-top: 3px; font-size: 0.64rem; color: var(--muted); line-height: 1.2; }

/* Мета: издатель / дата релиза / языки */
.gc-meta { margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.gc-info { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.gc-pub { font-size: 0.68rem; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.gc-date { font-size: 0.66rem; color: var(--faint); white-space: nowrap; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.gc-langs { display: flex; flex-direction: column; gap: 4px; }
.gc-lang { display: flex; align-items: baseline; gap: 6px; min-width: 0; cursor: default; }
.gc-lang-k { flex-shrink: 0; font-size: 0.58rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--purple); background: rgba(127, 156, 201, 0.12); padding: 1px 5px; border-radius: 4px; }
.gc-lang-v { font-size: 0.66rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.gc-lang-more { flex-shrink: 0; font-size: 0.6rem; font-weight: 700; color: var(--faint); }
/* Теги: жанр / возраст / дополнения */
.gc-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.gc-genre { font-size: 0.6rem; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: rgba(127, 156, 201, 0.12); color: var(--purple); }
.gc-age { font-size: 0.6rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--border); color: var(--muted); }
.gc-addons { font-size: 0.6rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: rgba(70, 207, 124, 0.12); color: var(--green); }

/* Всплывающее превью карточки (полная инфа при наведении) */
.gc-pop { position: fixed; z-index: 1200; display: none; width: 320px; max-width: 92vw; max-height: 90vh; overflow: hidden; padding: 13px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); pointer-events: none; animation: popIn 0.12s ease; }
@keyframes popIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.pop-head { display: flex; gap: 11px; align-items: flex-start; }
.pop-head img { width: 66px; height: 66px; flex-shrink: 0; border-radius: 8px; object-fit: cover; background: var(--bg-2); }
.pop-h-txt { min-width: 0; }
.pop-title { font-size: 0.9rem; font-weight: 700; line-height: 1.25; margin-bottom: 4px; }
.pop-sub { font-size: 0.72rem; color: var(--muted); margin-bottom: 7px; line-height: 1.3; }
.pop-plats { display: flex; gap: 4px; flex-wrap: wrap; }
.pop-plats span { font-size: 0.6rem; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--border); color: var(--muted); }
.pop-price { display: flex; align-items: baseline; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.pop-p { font-size: 1.08rem; font-weight: 800; letter-spacing: -0.01em; }
.pop-old { color: var(--faint); text-decoration: line-through; font-size: 0.78rem; }
.pop-disc { color: var(--green); font-size: 0.7rem; font-weight: 700; background: rgba(70, 207, 124, 0.12); padding: 1px 5px; border-radius: 4px; }
.pop-rate { margin-left: auto; color: var(--amber); font-weight: 700; font-size: 0.8rem; white-space: nowrap; }
.pop-plus { margin-top: 10px; padding: 7px 9px; border-radius: 8px; background: rgba(226, 193, 80, 0.07); border: 1px solid rgba(226, 193, 80, 0.22); border-left: 3px solid var(--accent); }
.pop-plus-row { display: flex; align-items: center; gap: 7px; }
.pop-plus-row b { color: var(--accent); font-weight: 800; font-size: 0.92rem; }
.pop-plus-disc { color: var(--green); font-weight: 800; font-size: 0.7rem; }
.pop-plus-cap { margin-top: 4px; font-size: 0.68rem; font-weight: 600; color: var(--accent-2); line-height: 1.25; }
.pop-plus-ends { margin-top: 3px; font-size: 0.64rem; color: var(--muted); }
.pop-lg { margin-top: 11px; }
.pop-lg-k { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--purple); margin-bottom: 5px; }
.pop-lg-v { display: flex; flex-wrap: wrap; gap: 4px; }
.pop-lg-v span { font-size: 0.66rem; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 4px; line-height: 1.5; }
/* Жанр + возраст + дескрипторы */
.pop-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 11px; }
.pop-genre { font-size: 0.64rem; font-weight: 600; padding: 2px 7px; border-radius: 5px; background: rgba(127, 156, 201, 0.14); color: var(--purple); }
.pop-age { display: inline-flex; align-items: center; gap: 5px; font-size: 0.64rem; font-weight: 700; padding: 2px 7px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.pop-age img { width: 16px; height: 20px; object-fit: contain; }
.pop-descr { margin-top: 5px; font-size: 0.63rem; color: var(--faint); line-height: 1.35; }
.pop-desc { margin-top: 9px; font-size: 0.72rem; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
/* Секции: особенности / издания / дополнения */
.pop-sect { margin-top: 11px; }
.pop-sect-k { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--purple); margin-bottom: 5px; }
.pop-compat { margin: 0; padding-left: 15px; }
.pop-compat li { font-size: 0.68rem; color: var(--muted); line-height: 1.5; }
.pop-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 2px 0; }
.pop-row-n { font-size: 0.68rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pop-row-p { font-size: 0.68rem; font-weight: 700; color: var(--accent); white-space: nowrap; flex-shrink: 0; }
.pop-row-more { font-size: 0.64rem; color: var(--faint); padding-top: 3px; }
.pop-row-t { font-style: normal; font-size: 0.6rem; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 0 5px; border-radius: 4px; margin-left: 4px; }

/* ===== Детальная модалка товара (по клику на карточку) ===== */
/* Широкая модалка только для страницы товара (обычные модалки остаются узкими). */
.modal:has(.product-modal) { max-width: min(1120px, 94vw); }
.modal-body:has(.product-modal) { padding: 0 22px 22px; }

/* Описание: свёрнуто до 6 строк, разворачивается по кнопке. */
.pop-desc-wrap { margin-bottom: 2px; }
.product-modal .pop-desc { font-size: 0.84rem; line-height: 1.55; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.product-modal .pop-desc.expanded { display: block; -webkit-line-clamp: unset; overflow: visible; }
.pop-desc-toggle { margin-top: 7px; background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--accent); font-size: 0.76rem; font-weight: 600; }
.pop-desc-toggle:hover { text-decoration: underline; }

/* Фон-подложка страницы товара (как на PS) — за шапкой, с затемнением. */
.pm-hero-wrap { position: relative; margin: 0 -22px; padding: 26px 22px 22px; overflow: hidden; }
.pm-backdrop { position: absolute; inset: 0; background-size: cover; background-position: center 20%; opacity: 0.3; }
.pm-hero-wrap::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(20,22,30,0.55) 0%, rgba(20,22,30,0.82) 60%, var(--surface) 100%); }
.pm-hero { position: relative; z-index: 1; }

/* Шапка: крупная обложка + цена/платформы/рейтинг/жанр справа. */
.pm-hero { display: flex; gap: 20px; align-items: flex-start; }
.pm-cover { flex: 0 0 240px; max-width: 240px; border-radius: 12px; overflow: hidden; background: var(--bg-2); aspect-ratio: 1; }
.pm-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pm-hero-body { flex: 1; min-width: 0; }
.pm-hero-body .pop-price { margin-top: 0; }
.pm-hero-body .pop-p { font-size: 1.5rem; }

/* Поля с подписями (Издатель, Дата, Жанр, Платформа, Возраст). */
.pm-facts { display: grid; grid-template-columns: max-content 1fr; gap: 5px 14px; margin-top: 16px;
  align-items: baseline; font-size: 0.8rem; }
.pm-fact-k { color: var(--faint); white-space: nowrap; }
.pm-fact-v { color: var(--text); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.pm-age-ic { width: 15px; height: 19px; object-fit: contain; }

/* Особенности в шапке — компактная сетка. */
.pm-hero-feats { margin-top: 16px; }

/* Описание/языки — ограниченной ширины (для читаемости). */
.pm-text { max-width: 780px; margin-top: 20px; }

/* Издания и дополнения — full-width секции с карточками в ряд. */
.pm-sect-wide { margin-top: 24px; }

/* Карточки изданий / дополнений — горизонтальной сеткой (как на PS). */
.pm-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; align-items: start; }
.pm-item { display: flex; gap: 12px; padding: 9px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
/* Известен артикул — карточка ведёт к этому изданию/дополнению в базе. */
.pm-item--link { cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.pm-item--link:hover { border-color: var(--accent); background: var(--surface); }
.pm-item-thumb { flex: 0 0 64px; width: 64px; height: 64px; border-radius: 7px; overflow: hidden; background: var(--bg-2); }
.pm-item-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pm-item-body { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.pm-item-name { font-size: 0.8rem; font-weight: 600; line-height: 1.3; }
.pm-item-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.pm-item-badges span { font-size: 0.58rem; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--border); color: var(--muted); }
.pm-item-type { text-transform: uppercase; letter-spacing: 0.03em; }
.pm-item-price { margin-top: auto; padding-top: 6px; display: flex; align-items: baseline; gap: 7px; }
.pm-item-p { font-size: 0.86rem; font-weight: 800; color: var(--accent); }
.pm-item-old { font-size: 0.68rem; color: var(--faint); text-decoration: line-through; }
.pm-item-disc { font-size: 0.62rem; font-weight: 700; color: var(--green); background: rgba(70, 207, 124, 0.12); padding: 1px 5px; border-radius: 4px; }
.pm-item-plus { margin-top: 3px; font-size: 0.64rem; font-weight: 600; color: var(--accent-2); line-height: 1.3; }
.pm-item-ends { margin-top: 2px; font-size: 0.62rem; color: var(--muted); }
.pm-item-feats { margin: 6px 0 0; padding-left: 15px; }
.pm-item-feats li { font-size: 0.64rem; color: var(--muted); line-height: 1.45; }

/* Галерея скриншотов — горизонтальная лента со скроллом. */
.pm-gallery { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 8px; margin-top: 18px;
  scrollbar-width: thin; }
.pm-shot { flex: 0 0 auto; width: 300px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  background: var(--bg-2); border: 1px solid var(--border); }
.pm-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Особенности — сетка (как на PS, но аккуратнее). */
.pm-feats { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 9px 16px; margin-top: 8px; align-items: start; }
.pm-feat { position: relative; padding-left: 16px; font-size: 0.76rem; color: var(--muted); line-height: 1.35; }
.pm-feat::before { content: ""; position: absolute; left: 2px; top: 0.5em; width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent); }
/* С иконкой PS (инлайн-SVG) — вместо точки. */
.pm-feat.has-ic { padding-left: 0; display: flex; gap: 9px; align-items: flex-start; }
.pm-feat.has-ic::before { display: none; }
.pm-feat-ic { flex: 0 0 22px; line-height: 0; margin-top: -1px; }
.pm-feat-ic svg { width: 22px; height: 22px; display: block; fill: #cbd0dc; }
/* Подзаголовок группы («Версия PS5»). */
.pm-feat-head { grid-column: 1 / -1; padding-left: 0; margin-top: 4px; font-weight: 700; color: var(--text); font-size: 0.72rem; }
.pm-feat-head::before { display: none; }

/* На узких экранах — одна колонка и обложка сверху. */
@media (max-width: 720px) {
  .pm-hero { flex-direction: column; align-items: stretch; }
  .pm-cover { flex-basis: auto; max-width: 200px; }
  .pm-items { grid-template-columns: 1fr; }
  .pm-shot { width: 240px; }
}

/* Строка «Полный каталог» в разделе Каталоги — выделяем как источник обхода БД */
.cat-full { border-left: 3px solid var(--accent); padding-left: 10px; border-radius: 6px; background: rgba(226, 193, 80, 0.05); padding-top: 4px; padding-bottom: 6px; }

/* Переключатель обогащения */
.switch { display: inline-flex; align-items: center; gap: 8px; margin: 14px 0 0; font-size: 0.85rem; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { width: auto; margin: 0; accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.switch span { line-height: 1.3; }
/* Бейдж «протухло» в карточке сохранённой базы (мета старше TTL / вышла из предзаказа). */
.gc-stale { font-size: 0.6rem; font-weight: 700; color: var(--amber); background: rgba(226, 193, 80, 0.12); padding: 1px 6px; border-radius: 4px; white-space: nowrap; }

.gc-plats { display: flex; gap: 4px; flex-wrap: wrap; margin-top: auto; padding-top: 9px; }
.gc-plats span { font-size: 0.6rem; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--border); color: var(--muted); letter-spacing: 0.02em; }

/* цена 0 / пустая — тревожная красная рамка */
.game-card.bad { border-color: var(--red); box-shadow: 0 0 0 1px var(--red) inset; }
.game-card.bad .gc-price { color: var(--red); }
.gc-badbadge { position: absolute; top: 6px; left: 6px; background: var(--red); color: #fff; font-size: 0.62rem; font-weight: 700; padding: 2px 6px; border-radius: 5px; z-index: 3; }

/* кнопка удаления — появляется при наведении */
.gc-del {
  position: absolute; top: 6px; right: 6px; z-index: 4;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  background: rgba(12, 14, 19, 0.82); border: 1px solid var(--border); color: var(--red);
  border-radius: 7px; cursor: pointer; opacity: 0; transform: scale(0.9); transition: all 0.15s;
}
.gc-del svg { width: 15px; height: 15px; }
.game-card:hover .gc-del { opacity: 1; transform: scale(1); }
.gc-del:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* выбор для массового удаления */
.game-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.gc-check {
  position: absolute; top: 6px; left: 6px; z-index: 4; width: 24px; height: 24px; border-radius: 6px;
  background: rgba(12, 14, 19, 0.82); border: 1px solid var(--border); display: none;
  align-items: center; justify-content: center; cursor: pointer; color: transparent;
}
.select-mode .gc-check { display: flex; }
.game-card.selected .gc-check { background: var(--accent); border-color: var(--accent); color: #16130a; }
.gc-check svg { width: 15px; height: 15px; }
.select-mode .game-card { cursor: pointer; }
.select-mode .gc-del { display: none; }

/* ---------- Воркспейс парсера ---------- */
.parser-layout { display: flex; flex-direction: column; gap: 16px; height: 100%; }
.parser-controls { flex-shrink: 0; margin-bottom: 0; }
.parser-catalog { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.catalog-head { flex-shrink: 0; padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.catalog-head .ch-title { font-size: 0.98rem; font-weight: 700; margin: 0; }
.catalog-head .ch-sub { color: var(--muted); font-size: 0.82rem; }
.catalog-search { margin-left: auto; width: 230px; max-width: 42vw; padding: 8px 12px 8px 32px; font-size: 0.85rem;
  background: var(--bg-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b91a2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 9px center; }
.catalog-search::-webkit-search-cancel-button { filter: invert(0.6); cursor: pointer; }
.catalog-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.catalog-counts { display: flex; gap: 8px; flex-wrap: wrap; }
.count-chip { font-size: 0.76rem; font-weight: 700; padding: 3px 9px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.count-chip b { color: var(--text); }
.count-chip.bad { color: var(--red); border-color: rgba(239,90,112,0.3); }
.count-chip.bad b { color: var(--red); }
.count-chip.sel { color: var(--accent); border-color: rgba(226,193,80,0.3); }
.count-chip.sel b { color: var(--accent); }
.btn.toggled { background: var(--accent); border-color: var(--accent); color: #16130a; }
.btn.toggled svg { color: #16130a; }
.cards-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px; }
.parse-inputs { display: grid; grid-template-columns: 1fr 1fr 130px auto auto; gap: 12px; align-items: end; }
/* Панель обхода Базы данных: поля отдельно от кнопок — чтобы не было каши */
.db-form { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; }
.db-fields { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(200px, 1fr) 150px; gap: 12px; flex: 1; min-width: 280px; }
.db-fields label { margin: 0 0 5px; }
.db-actions { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
@media (max-width: 760px) { .db-fields { grid-template-columns: 1fr 1fr; } .db-actions { width: 100%; } }
.parse-inputs label { margin: 0 0 5px; }
@media (max-width: 760px) { .parse-inputs { grid-template-columns: 1fr 1fr; } }

/* ---------- Разное ---------- */
.empty { text-align: center; color: var(--muted); padding: 42px 20px; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.25); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-track { height: 8px; background: var(--bg-2); border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent-deep), var(--accent-2)); transition: width 0.3s; }
.chart-box { width: 100%; height: 220px; }
.hint { color: var(--muted); font-size: 0.85rem; line-height: 1.5; }
.code-block { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; font-family: var(--font-mono); font-size: 0.82rem; color: var(--accent-2); overflow-x: auto; white-space: pre; }
.copy-field { display: flex; gap: 8px; align-items: center; }
.copy-field input { font-family: var(--font-mono); color: var(--accent-2); }
.region-pill { display: inline-flex; align-items: center; font-size: 0.7rem; font-weight: 700; padding: 2px 7px; border-radius: 5px; background: rgba(226,193,80,0.12); color: var(--accent); letter-spacing: 0.03em; }

/* ---------- Модалка ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; padding: 24px; z-index: 100;
}
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 1.05rem; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 22px; }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.modal-actions .btn { flex: 1; justify-content: center; }

/* ---------- Тосты ---------- */
.toasts { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast {
  background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 12px 16px; font-size: 0.88rem; box-shadow: var(--shadow);
  min-width: 240px; animation: slidein 0.25s ease;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.filters > div { min-width: 130px; }
.filters label { margin-top: 0; }

/* ================= Автопарсер ================= */
.ap-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.ap-run { font-size: 0.8rem; font-weight: 700; color: var(--faint); }
.ap-run.on { color: var(--green); }
.ap-inputs { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.ap-inputs > div { display: flex; flex-direction: column; gap: 5px; }
.ap-inputs label { font-size: 0.72rem; color: var(--muted); }
.ap-inputs input { width: 130px; }
.ap-cats { display: flex; flex-direction: column; gap: 8px; }
.ap-cat { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }
.ap-cat .switch { margin: 0; min-width: 160px; }
.ap-limit { display: flex; align-items: center; gap: 8px; }
.ap-limit label { font-size: 0.72rem; color: var(--muted); }
.ap-limit input { width: 90px; }
.ap-badge { font-size: 0.66rem; font-weight: 700; padding: 2px 8px; border-radius: 5px; background: var(--border); color: var(--muted); }
.ap-badge.green { background: rgba(70, 207, 124, 0.14); color: var(--green); }
.ap-badge.amber { background: rgba(224, 169, 58, 0.14); color: var(--amber); }
.ap-badge.red { background: rgba(239, 90, 112, 0.14); color: var(--red); }
.ap-badge.muted { background: var(--border); color: var(--muted); }
.ap-status-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ap-res { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-top: 1px solid var(--border); }
.ap-res:first-of-type { border-top: none; }
.ap-res-n { flex: 1; font-size: 0.82rem; }
.ap-err { font-size: 0.7rem; color: var(--red); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
