/* ═══════════════════════════════════════════════════════════════════════════
   OverGear Market — дизайн-система «Металл»
   Тёмная: графит #1f1f1f + оранжевый #FF6B35. Светлая: #f8f9fa + синий #0052cc.
   Тема переключается атрибутом data-theme на <html>.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg: #1f1f1f;
  --bg-soft: #262626;
  --surface: #2a2a2a;
  --surface-2: #333333;
  --surface-3: #3d3d3d;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.19);
  --text: #f0f0f0;
  --muted: #b4b4b4;
  --faint: #8c8c8c;
  --accent: #FF6B35;
  --accent-2: #ff9d5c;
  --grad: linear-gradient(135deg, #FF6B35 0%, #ff9440 100%);
  --good: #3dd68c;
  --warn: #ffc24b;
  --bad: #ff5c5c;
  --overlay: rgba(12, 12, 12, 0.72);
  --topbar-bg: rgba(31, 31, 31, 0.85);
  --chip-active-text: #fff;
  --glow-1: rgba(255, 107, 53, 0.10);
  --glow-2: rgba(255, 148, 64, 0.05);
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.55);
  --header-h: 66px;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f8f9fa;
  --bg-soft: #f1f3f5;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --surface-3: #e7eaee;
  --line: rgba(26, 26, 26, 0.10);
  --line-strong: rgba(26, 26, 26, 0.22);
  --text: #1a1a1a;
  --muted: #5c6470;
  --faint: #8d94a0;
  --accent: #FF6B35;
  --accent-2: #d4531a;
  --grad: linear-gradient(135deg, #FF6B35 0%, #ff8f45 100%);
  --good: #148a54;
  --warn: #b07a00;
  --bad: #d63333;
  --overlay: rgba(26, 30, 38, 0.45);
  --topbar-bg: rgba(248, 249, 250, 0.85);
  --chip-active-text: #fff;
  --glow-1: rgba(255, 107, 53, 0.09);
  --glow-2: rgba(255, 107, 53, 0.05);
  --shadow: 0 16px 44px -22px rgba(15, 25, 46, 0.28);
  color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* hidden должен побеждать любые display-правила классов */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: "Manrope", -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(900px 480px at 85% -10%, var(--glow-1), transparent 60%),
    radial-gradient(700px 420px at -10% 10%, var(--glow-2), transparent 55%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }

.container { width: min(1200px, 100% - 32px); margin-inline: auto; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}

::selection { background: rgba(255, 107, 53, 0.4); }

/* ── Кнопки ── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--r-sm);
  font-weight: 700; font-size: 14px; line-height: 1.2;
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-main {
  background: var(--grad); color: #fff;
  box-shadow: 0 8px 24px -10px rgba(255, 107, 53, 0.7);
}
.btn-main:hover:not(:disabled) { box-shadow: 0 10px 30px -8px rgba(255, 107, 53, 0.85); }

.btn-soft { background: var(--surface-2); border-color: var(--line); }
.btn-soft:hover:not(:disabled) { background: var(--surface-3); border-color: var(--line-strong); }

.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.05); }

.btn-danger { background: rgba(255, 92, 92, 0.10); border-color: rgba(255, 92, 92, 0.4); color: var(--bad); }
.btn-danger:hover:not(:disabled) { background: rgba(255, 92, 92, 0.18); }

.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 15px 28px; font-size: 16px; border-radius: 13px; }
.btn-block { width: 100%; }

.link { color: var(--accent-2); font-weight: 600; }
.link:hover { text-decoration: underline; }

/* ── Поля ── */

.field { display: grid; gap: 7px; }
.field > span { font-size: 13px; font-weight: 700; color: var(--muted); }
.field small { color: var(--faint); font-size: 12px; }

.input, .select, .textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 11px 14px;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.22);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' stroke='%2399a2b5' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }

.checkbox-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--bg-soft); cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.checkbox-row:hover { border-color: var(--line-strong); }
.checkbox-row input { accent-color: var(--accent); width: 17px; height: 17px; margin-top: 2px; flex: none; }
.checkbox-row.is-checked { border-color: rgba(255, 107, 53, 0.55); background: rgba(255, 107, 53, 0.08); }

/* ── Карточки-поверхности ── */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
}
.panel-title { font-size: 17px; margin-bottom: 14px; }

/* ── Чипы и бейджи ── */

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 13.5px; font-weight: 700; color: var(--muted);
  transition: all 0.15s; cursor: pointer; white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip.is-active { background: var(--grad); color: #fff; border-color: transparent; }
.chip .chip-count { font-size: 11.5px; opacity: 0.75; font-weight: 600; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 800; letter-spacing: 0.02em;
  padding: 4px 9px; border-radius: 7px;
}
.badge-good { background: rgba(61, 214, 140, 0.14); color: var(--good); }
.badge-warn { background: rgba(255, 194, 75, 0.14); color: var(--warn); }
.badge-bad { background: rgba(255, 107, 107, 0.14); color: var(--bad); }
.badge-accent { background: rgba(255, 107, 53, 0.16); color: var(--accent); }
.badge-muted { background: var(--surface-2); color: var(--muted); }

.dot-online { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px rgba(61, 214, 140, 0.18); flex: none; }
.dot-offline { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); opacity: .6; flex: none; }

/* ── Шапка ── */

.topbar {
  position: sticky; top: 0; z-index: 90;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: 18px;
}

.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--grad);
  display: grid; place-items: center;
  font-family: "Unbounded", "Manrope", sans-serif;
  font-weight: 800; font-size: 15px; color: #fff;
  box-shadow: 0 6px 18px -6px rgba(255, 107, 53, 0.8);
}
.brand-name {
  font-family: "Unbounded", "Manrope", sans-serif;
  font-weight: 700; font-size: 16px; letter-spacing: 0.01em;
}
.brand-name span { color: var(--accent); }

.brand-logo {
  width: 40px; height: 40px; flex: none;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(255, 107, 53, 0.35));
}
.site-footer .brand-logo { width: 34px; height: 34px; }

.topbar-nav { display: flex; align-items: center; gap: 4px; }
.topbar-nav a {
  padding: 9px 13px; border-radius: 9px;
  font-weight: 700; font-size: 14px; color: var(--muted);
  transition: color 0.15s, background 0.15s;
}
.topbar-nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.topbar-nav a.is-active { color: var(--text); background: var(--surface-2); }

.topbar-search { flex: 1; max-width: 420px; position: relative; }
.topbar-search input {
  width: 100%; padding: 10px 14px 10px 40px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
  color: var(--text); font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.topbar-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2); }
.topbar-search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); opacity: 0.5; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }

.balance-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-weight: 800; font-size: 13.5px;
  transition: border-color 0.15s;
}
.balance-chip:hover { border-color: var(--accent); }
.balance-chip .plus {
  width: 18px; height: 18px; border-radius: 6px; background: var(--grad);
  display: grid; place-items: center; font-size: 13px; color: #fff; font-weight: 800; line-height: 1;
}

.user-pill {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 12px 5px 5px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-weight: 700; font-size: 13.5px; cursor: pointer;
  transition: border-color 0.15s;
}
.user-pill:hover { border-color: var(--line-strong); }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--grad); color: #fff;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 800; text-transform: uppercase;
  flex: none; overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-menu-wrap { position: relative; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 10px);
  min-width: 230px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r); box-shadow: var(--shadow);
  padding: 7px; z-index: 100;
  display: none;
}
.user-menu.open { display: block; }
.user-menu a, .user-menu button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 10px 12px; border-radius: 9px;
  font-weight: 600; font-size: 14px; color: var(--text);
}
.user-menu a:hover, .user-menu button:hover { background: var(--surface-2); }
.user-menu .menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.user-menu .menu-danger { color: var(--bad); }
.user-menu .menu-note { padding: 8px 12px 4px; font-size: 11.5px; color: var(--faint); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }

.burger { display: none; padding: 8px; border-radius: 9px; border: 1px solid var(--line); }
.burger:hover { background: var(--surface-2); }

.mobile-nav {
  display: none;
  border-top: 1px solid var(--line);
  padding: 10px 0 14px;
}
.mobile-nav.open { display: grid; gap: 4px; }
.mobile-nav a {
  padding: 11px 13px; border-radius: 9px; font-weight: 700; color: var(--muted);
}
.mobile-nav a:hover, .mobile-nav a.is-active { color: var(--text); background: var(--surface-2); }

/* ── Герой главной ── */

.hero { padding: 44px 0 26px; }
.hero h1 {
  font-size: clamp(26px, 4.2vw, 44px);
  max-width: 700px;
}
.hero h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); margin-top: 12px; max-width: 560px; font-size: 16px; }

.hero-search { margin-top: 24px; max-width: 560px; position: relative; }
.hero-search input {
  width: 100%; padding: 16px 130px 16px 48px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 16px;
  color: var(--text); font-size: 15.5px;
  box-shadow: var(--shadow);
}
.hero-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.2); }
.hero-search svg { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); opacity: 0.5; }
.hero-search .btn { position: absolute; right: 7px; top: 7px; bottom: 7px; }

.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.hero-stats { display: flex; gap: 34px; margin-top: 30px; flex-wrap: wrap; }
.hero-stats article strong { font-size: 22px; font-weight: 800; display: block; }
.hero-stats article span { color: var(--faint); font-size: 13px; font-weight: 600; }

/* ── Bento-грид игр: плитки разного размера, обложка всегда без полей ── */

.games-section { padding: 8px 0 60px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 26px 0 18px; }
.section-head h2 { font-size: 22px; }
.section-head .muted-link { color: var(--faint); font-weight: 700; font-size: 13.5px; }
.section-head .muted-link:hover { color: var(--text); }

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  grid-auto-rows: 108px;
  grid-auto-flow: dense;
  gap: 14px;
}

.game-tile {
  position: relative;
  border-radius: var(--r);
  overflow: hidden;
  grid-row: span 2;
  border: 1px solid var(--line);
  background: var(--surface-2);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
  isolation: isolate;
}
.game-tile:hover { transform: translateY(-3px); border-color: rgba(255, 107, 53, 0.6); box-shadow: 0 20px 44px -18px rgba(255, 107, 53, 0.45); }

.game-tile img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: -1;
  transition: transform 0.35s ease;
}
.game-tile:hover img { transform: scale(1.05); }

.game-tile::after {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(180deg, rgba(8, 9, 14, 0) 35%, rgba(8, 9, 14, 0.55) 68%, rgba(8, 9, 14, 0.92) 100%);
}

.game-tile .tile-body {
  position: absolute; inset: auto 0 0 0; z-index: 1;
  padding: 12px 14px;
}
.game-tile .tile-title { font-weight: 800; font-size: 15px; line-height: 1.25; letter-spacing: -0.01em; }
.game-tile .tile-meta { margin-top: 4px; font-size: 12px; color: rgba(255, 255, 255, 0.72); font-weight: 600; display: flex; gap: 8px; flex-wrap: wrap; }
.game-tile .tile-meta strong { color: #fff; }

/* Размеры плиток: за счёт span сетка плотно пакуется без пустот */
.game-tile.t-tall { grid-row: span 3; }
.game-tile.t-wide { grid-column: span 2; grid-row: span 2; }
.game-tile.t-big { grid-column: span 2; grid-row: span 3; }
.game-tile.t-big .tile-title { font-size: 20px; }
.game-tile.t-big .tile-body, .game-tile.t-wide .tile-body { padding: 16px 18px; }

.games-empty { color: var(--muted); padding: 40px 0; text-align: center; grid-column: 1 / -1; }

/* ── Страница игры ── */

.game-hero {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--line);
  margin-top: 22px;
  min-height: 190px;
  display: flex; align-items: flex-end;
  isolation: isolate;
}
.game-hero img.game-hero-bg {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  z-index: -1; filter: blur(34px) saturate(1.6) brightness(0.9); transform: scale(1.3);
}
.game-hero::after {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(560px 260px at 12% 100%, rgba(255, 107, 53, 0.28), transparent 65%),
    repeating-linear-gradient(115deg, rgba(255,255,255,0.045) 0 1px, transparent 1px 26px),
    linear-gradient(90deg, rgba(10, 10, 12, 0.78) 8%, rgba(10, 10, 12, 0.35) 55%, rgba(10, 10, 12, 0.55));
}
.game-hero-inner { position: relative; z-index: 1; display: flex; gap: 20px; align-items: flex-end; padding: 24px; width: 100%; }
.game-hero-cover {
  width: 128px; aspect-ratio: 3 / 4; border-radius: 16px; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22); flex: none;
  box-shadow: 0 12px 34px -10px rgba(0, 0, 0, 0.6), 0 0 44px -8px rgba(255, 107, 53, 0.45);
}
.game-hero-cover img { width: 100%; height: 100%; object-fit: cover; }
.game-hero-info h1 { font-size: clamp(24px, 3.6vw, 38px); text-shadow: 0 2px 18px rgba(0,0,0,.5); }
.game-hero-info p { color: var(--muted); margin-top: 6px; font-weight: 600; font-size: 13.5px; }
.game-hero-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.game-hero-badges .badge { font-size: 12.5px; padding: 6px 11px; backdrop-filter: blur(6px); background: rgba(255,255,255,0.09); color: #fff; }
.game-hero-badges .badge strong { color: #ffb28a; }

.cat-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 6px; }

.offers-toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin: 14px 0 16px;
}
.offers-toolbar .input { max-width: 260px; }
.offers-toolbar .select { max-width: 200px; width: auto; }
.offers-toolbar .toolbar-spacer { flex: 1; }

.toggle-row { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; color: var(--muted); cursor: pointer; user-select: none; }
.toggle-row input { accent-color: var(--accent); width: 16px; height: 16px; }

/* Строка оффера */
.offer-list { display: grid; gap: 10px; padding-bottom: 60px; }

.offer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 18px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 15px 18px;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.offer-row:hover { border-color: rgba(255, 107, 53, 0.55); background: var(--surface-2); transform: translateY(-1px); }

.offer-row .offer-title { font-weight: 800; font-size: 15px; line-height: 1.35; }
.offer-row .offer-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.offer-row .offer-sub .sep { opacity: 0.4; }

.offer-price { text-align: right; }
.offer-price .p { font-size: 17px; font-weight: 800; white-space: nowrap; }
.offer-price .p small { font-size: 12px; color: var(--muted); font-weight: 700; }
.offer-price .from { font-size: 11.5px; color: var(--faint); font-weight: 700; }

.seller-mini { display: inline-flex; align-items: center; gap: 7px; }
.seller-mini .user-avatar { width: 22px; height: 22px; font-size: 10.5px; }
.star { color: var(--warn); }

/* ── Карточка оффера ── */

.offer-layout {
  display: grid; grid-template-columns: 1fr 360px; gap: 22px;
  align-items: start;
  padding: 22px 0 60px;
}

.crumbs { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 18px; font-size: 13px; color: var(--faint); font-weight: 600; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { opacity: 0.5; }

.offer-head { display: flex; gap: 16px; align-items: flex-start; }
.offer-head-cover { width: 86px; aspect-ratio: 3/4; border-radius: 12px; overflow: hidden; flex: none; border: 1px solid var(--line-strong); }
.offer-head-cover img { width: 100%; height: 100%; object-fit: cover; }
.offer-head h1 { font-size: clamp(20px, 3vw, 28px); }
.offer-head .offer-head-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.offer-desc { margin-top: 20px; }
.offer-desc h3 { font-size: 15px; margin-bottom: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-size: 12.5px; }
.offer-desc .desc-body { white-space: pre-line; color: var(--muted); line-height: 1.65; }

.buy-card { position: sticky; top: calc(var(--header-h) + 16px); display: grid; gap: 16px; }

.qty-box { display: grid; gap: 8px; }
.qty-controls { display: flex; align-items: stretch; gap: 8px; }
.qty-controls .input { text-align: center; font-weight: 800; font-size: 16px; }
.qty-btn {
  width: 46px; border-radius: var(--r-sm); flex: none;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 19px; font-weight: 800; color: var(--muted);
  transition: all .15s;
}
.qty-btn:hover { color: var(--text); border-color: var(--line-strong); }
.qty-hint { font-size: 12px; color: var(--faint); font-weight: 600; }
.qty-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.qty-presets .chip { padding: 6px 12px; font-size: 12.5px; }

.opt-group { display: grid; gap: 8px; }
.opt-group-name { font-size: 13px; font-weight: 800; color: var(--muted); }

.price-summary { border-top: 1px dashed var(--line-strong); padding-top: 14px; display: grid; gap: 7px; }
.price-line { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--muted); font-weight: 600; }
.price-line.total { font-size: 15px; color: var(--text); font-weight: 800; }
.price-line.total .val { font-size: 22px; }

.seller-card { display: flex; align-items: center; gap: 12px; }
.seller-card .user-avatar { width: 44px; height: 44px; font-size: 17px; }
.seller-card .s-name { font-weight: 800; display: flex; align-items: center; gap: 8px; }
.seller-card .s-meta { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }

.reviews-block { margin-top: 26px; display: grid; gap: 12px; }
.review-item { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; background: var(--surface); }
.review-item .r-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 700; }
.review-item .r-date { color: var(--faint); font-weight: 600; }
.review-item .r-text { margin-top: 6px; color: var(--muted); }

/* ── Заказ и чат ── */

.order-layout { display: grid; grid-template-columns: 1fr 380px; gap: 22px; align-items: start; padding: 22px 0 60px; }

.chat-panel { display: flex; flex-direction: column; min-height: 460px; max-height: 640px; }
.chat-scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 12px; }
.chat-msg { max-width: 82%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; white-space: pre-line; word-break: break-word; }
.chat-msg .m-meta { display: block; font-size: 11px; color: var(--faint); font-weight: 700; margin-bottom: 3px; }
.chat-msg.theirs { background: var(--surface-2); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 5px; }
.chat-msg.mine { background: linear-gradient(135deg, rgba(124,92,255,.28), rgba(76,194,255,.20)); border: 1px solid rgba(255, 107, 53, 0.45); align-self: flex-end; border-bottom-right-radius: 5px; }
.chat-msg.system { align-self: center; background: rgba(255, 194, 75, 0.08); border: 1px dashed rgba(255, 194, 75, 0.35); color: #e8d9b0; font-size: 12.5px; max-width: 95%; text-align: center; }
.chat-form { display: flex; gap: 8px; margin-top: 12px; }
.chat-form .input { flex: 1; }

.status-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.kv-list { display: grid; gap: 9px; }
.kv-line { display: flex; justify-content: space-between; gap: 14px; font-size: 13.5px; }
.kv-line .k { color: var(--muted); font-weight: 600; }
.kv-line .v { font-weight: 700; text-align: right; }

/* ── Таблицы кабинетов ── */

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 560px; }
.data-table th {
  text-align: left; padding: 10px 12px; color: var(--faint);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line);
}
.data-table td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr.clickable { cursor: pointer; transition: background 0.12s; }
.data-table tr.clickable:hover { background: var(--surface-2); }

/* ── Вкладки ── */

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab-btn {
  padding: 11px 16px; font-weight: 800; font-size: 14px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.is-active { color: var(--text); border-bottom-color: var(--accent); }

/* ── Статистика ── */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.stat-card .s-label { font-size: 12px; color: var(--faint); font-weight: 700; }
.stat-card .s-value { font-size: 21px; font-weight: 800; margin-top: 4px; letter-spacing: -0.02em; }
.stat-card .s-value small { font-size: 13px; color: var(--muted); }

/* ── Страницы кабинетов ── */

.page-head { padding: 30px 0 8px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(22px, 3.4vw, 30px); }
.page-head p { color: var(--muted); margin-top: 5px; }

.cabinet-grid { display: grid; gap: 16px; padding-bottom: 60px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

.listing-manage-row {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: center;
  border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px;
  background: var(--surface);
}
.listing-manage-row img { width: 52px; height: 66px; object-fit: cover; border-radius: 9px; }
.listing-manage-row .lm-title { font-weight: 800; font-size: 14px; line-height: 1.3; }
.listing-manage-row .lm-sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; font-weight: 600; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.listing-manage-row .lm-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }

/* ── Конструктор опций ── */

.builder-group { border: 1px solid var(--line-strong); border-radius: var(--r); padding: 16px; background: var(--bg-soft); display: grid; gap: 12px; }
.builder-group-head { display: flex; gap: 10px; align-items: center; }
.builder-group-head .input { flex: 1; }
.builder-choice { display: grid; grid-template-columns: 1fr 130px 38px; gap: 8px; align-items: center; }
.builder-choice .remove-btn, .builder-group .remove-btn {
  width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center;
  border: 1px solid var(--line); color: var(--faint); font-size: 16px;
}
.builder-choice .remove-btn:hover, .builder-group .remove-btn:hover { color: var(--bad); border-color: rgba(255, 107, 107, 0.4); }
.builder-add { border-style: dashed; color: var(--muted); }

.price-mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.price-mode-switch .mode-btn {
  padding: 13px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--bg-soft); font-weight: 700; font-size: 13.5px; color: var(--muted);
  display: grid; gap: 3px; text-align: left;
}
.price-mode-switch .mode-btn small { font-weight: 600; font-size: 11.5px; color: var(--faint); }
.price-mode-switch .mode-btn.is-active { border-color: var(--accent); background: rgba(255, 107, 53, 0.1); color: var(--text); }

/* ── Модалки ── */

.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: var(--overlay); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  width: min(480px, 100%);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r-lg); padding: 24px;
  box-shadow: var(--shadow);
  max-height: 90vh; overflow-y: auto;
}
.modal h3 { font-size: 18px; margin-bottom: 6px; }
.modal .modal-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 16px; }

/* ── Тосты ── */

.toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 300; display: grid; gap: 10px; max-width: min(360px, calc(100vw - 40px)); }
.toast {
  padding: 13px 16px; border-radius: 12px; font-weight: 600; font-size: 14px;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease;
}
.toast.success { border-color: rgba(61, 214, 140, 0.5); }
.toast.error { border-color: rgba(255, 107, 107, 0.5); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Auth ── */

.auth-wrap { min-height: calc(100vh - var(--header-h)); display: grid; place-items: center; padding: 40px 0; }
.auth-card { width: min(440px, 100%); }
.auth-card .panel { padding: 28px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--bg-soft); padding: 5px; border-radius: 12px; margin-bottom: 20px; border: 1px solid var(--line); }
.auth-tabs .btn { border-radius: 9px; }
.auth-form { display: grid; gap: 14px; }
.auth-form label { display: grid; gap: 7px; font-size: 13px; font-weight: 700; color: var(--muted); }
.auth-form input:not([type="checkbox"]) {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 11px 14px; color: var(--text);
}
.auth-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.22); }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 86px; }
.password-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 12px; font-weight: 700; color: var(--muted);
  padding: 5px 9px; border-radius: 7px; border: 1px solid var(--line);
}
.password-toggle:hover { color: var(--text); }
.auth-link-btn { color: var(--accent-2); font-weight: 700; font-size: 13.5px; justify-self: start; }
.auth-link-btn:hover { text-decoration: underline; }
.auth-status { margin-top: 14px; font-size: 13.5px; color: var(--warn); font-weight: 600; min-height: 20px; }
.auth-consent-label { display: flex !important; flex-direction: row; gap: 10px; align-items: flex-start; font-weight: 600 !important; }
.auth-consent-label input { width: 16px; height: 16px; accent-color: var(--accent); margin-top: 2px; }
.auth-consent-label a { color: var(--accent-2); }
.password-strength { display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); }
.password-strength-head { display: flex; justify-content: space-between; font-weight: 700; }
.password-strength-bar { height: 5px; border-radius: 3px; background: var(--bg-soft); overflow: hidden; border: 1px solid var(--line); }
.password-strength-bar span { display: block; height: 100%; width: 10%; background: var(--bad); border-radius: 3px; transition: width 0.25s, background 0.25s; }
.auth-reset-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.auth-reset-title { margin-bottom: 12px; font-size: 16px; }
.auth-reset-status { margin-top: 10px; font-size: 13px; color: var(--warn); }
.auth-kicker { color: var(--faint); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.auth-title { font-size: 24px; margin-bottom: 18px; }

/* ── Футер ── */

.site-footer { border-top: 1px solid var(--line); background: var(--bg-soft); margin-top: auto; }
.footer-inner { padding: 34px 0 26px; display: grid; gap: 24px; }
.footer-cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 26px; }
.footer-cols h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); margin-bottom: 12px; }
.footer-cols nav { display: grid; gap: 8px; }
.footer-cols a { color: var(--muted); font-weight: 600; font-size: 13.5px; }
.footer-cols a:hover { color: var(--text); }
.footer-brand p { color: var(--muted); font-size: 13.5px; margin-top: 10px; max-width: 300px; }
.footer-bottom { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--faint); font-size: 12.5px; border-top: 1px solid var(--line); padding-top: 18px; }

/* ── Утилиты ── */

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.nowrap { white-space: nowrap; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.grid-gap { display: grid; gap: 14px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.empty-note { color: var(--faint); text-align: center; padding: 34px 16px; font-weight: 600; }
.skeleton { border-radius: var(--r); background: linear-gradient(100deg, var(--surface) 40%, var(--surface-2) 50%, var(--surface) 60%); background-size: 200% 100%; animation: sk 1.4s infinite linear; }
@keyframes sk { from { background-position: 130% 0; } to { background-position: -30% 0; } }

/* ── Адаптив ── */

@media (max-width: 1020px) {
  .offer-layout, .order-layout { grid-template-columns: 1fr; }
  .buy-card { position: static; }
  .two-col { grid-template-columns: 1fr; }
  .footer-cols { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  .topbar-nav, .topbar-search { display: none; }
  .burger { display: grid; place-items: center; }
  .games-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); grid-auto-rows: 92px; gap: 10px; }
  .game-tile .tile-title { font-size: 13.5px; }
  .game-tile .tile-meta { font-size: 11px; }
  .game-tile.t-big .tile-title { font-size: 16px; }
  .hero { padding: 30px 0 18px; }
  .balance-chip .balance-label { display: none; }
}

@media (max-width: 640px) {
  body { font-size: 14px; }
  .offer-row { grid-template-columns: 1fr; }
  .offer-price { text-align: left; display: flex; align-items: baseline; gap: 10px; }
  .game-hero-inner { padding: 16px; gap: 14px; }
  .game-hero-cover { width: 86px; }
  .user-pill .user-name { display: none; }
  .footer-cols { grid-template-columns: 1fr; }
  .listing-manage-row { grid-template-columns: 44px 1fr; }
  .listing-manage-row .lm-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .builder-choice { grid-template-columns: 1fr 92px 38px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Переключатель темы ── */

.theme-toggle {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  border: 1px solid var(--line); background: var(--surface-2);
  display: grid; place-items: center; font-size: 16px;
  transition: border-color .15s, transform .15s;
}
.theme-toggle:hover { border-color: var(--accent); transform: rotate(12deg); }

/* Плитки игр: текст всегда белый — он лежит на тёмном градиенте поверх обложки */
.game-tile .tile-title { color: #fff; }
.game-tile .tile-meta { color: rgba(255, 255, 255, 0.75); }
.game-tile .tile-meta strong { color: #fff; }
.game-hero-info h1, .game-hero-info p { color: #fff; }
.game-hero-info p { opacity: .8; }

/* ── Доводка светлой темы ── */

html[data-theme="light"] .btn-ghost:hover:not(:disabled) { background: rgba(26, 26, 26, 0.05); }
html[data-theme="light"] .topbar-nav a:hover { background: rgba(26, 26, 26, 0.05); }
html[data-theme="light"] .badge-good { background: rgba(20, 138, 84, 0.12); }
html[data-theme="light"] .badge-warn { background: rgba(176, 122, 0, 0.12); }
html[data-theme="light"] .badge-bad { background: rgba(214, 51, 51, 0.1); }
html[data-theme="light"] .badge-accent { background: rgba(255, 107, 53, 0.13); color: #d14a15; }
html[data-theme="light"] .chat-msg.mine { background: rgba(255, 107, 53, 0.12); border-color: rgba(255, 107, 53, 0.4); }
html[data-theme="light"] .chat-msg.system { background: rgba(176, 122, 0, 0.07); border-color: rgba(176, 122, 0, 0.35); color: #7a5c10; }

html[data-theme="light"] .price-mode-switch .mode-btn.is-active { background: rgba(255, 107, 53, 0.08); }
html[data-theme="light"] .checkbox-row.is-checked { background: rgba(255, 107, 53, 0.07); }

/* ── Живые подсказки поиска ── */

.search-suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 120;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r); box-shadow: var(--shadow);
  padding: 6px; max-height: min(480px, 70vh); overflow-y: auto;
}
.search-suggest .ss-label {
  padding: 8px 12px 4px; font-size: 11px; font-weight: 800;
  color: var(--faint); text-transform: uppercase; letter-spacing: 0.07em;
}
.search-suggest .ss-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: 10px;
}
.search-suggest .ss-item:hover { background: var(--surface-2); }
.search-suggest .ss-cover {
  width: 36px; height: 48px; object-fit: cover; border-radius: 7px; flex: none;
  border: 1px solid var(--line);
}
.search-suggest .ss-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.search-suggest .ss-title {
  font-weight: 700; font-size: 13.5px; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.search-suggest .ss-sub {
  font-size: 12px; color: var(--faint); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.search-suggest .ss-price { font-weight: 800; font-size: 13.5px; white-space: nowrap; }
.search-suggest .ss-price small { color: var(--muted); font-weight: 700; font-size: 11px; }
.search-suggest .ss-empty { padding: 14px 12px; color: var(--faint); font-size: 13px; font-weight: 600; }
.search-suggest .ss-all {
  display: block; width: 100%; text-align: center;
  padding: 10px; margin-top: 4px; border-top: 1px solid var(--line);
  color: var(--accent-2); font-weight: 700; font-size: 13px;
}
.search-suggest .ss-all:hover { background: var(--surface-2); border-radius: 0 0 10px 10px; }

/* ── Плитки по ориентации обложки ──
   Базовая плитка 1×2 ≈ 0.66 — идеально под вертикальный постер 600×900.
   Классы навешивает JS после загрузки картинки по её реальным пропорциям. */
.game-tile.t-p-big { grid-column: span 2; grid-row: span 4; }   /* витринный вертикальный, ≈0.68 */
.game-tile.t-sq    { grid-column: span 2; grid-row: span 3; }   /* квадратные арты, ≈0.90 */
.game-tile.t-land  { grid-column: span 2; grid-row: span 2; }   /* горизонтальные, ≈1.38 */
.game-tile.t-p-big .tile-title, .game-tile.t-sq .tile-title { font-size: 19px; }
.game-tile.t-p-big .tile-body, .game-tile.t-sq .tile-body, .game-tile.t-land .tile-body { padding: 16px 18px; }

@media (max-width: 860px) {
  .game-tile.t-p-big .tile-title, .game-tile.t-sq .tile-title { font-size: 15.5px; }
}

/* ── Крупные карточки категорий на странице игры ── */

.cat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin: 20px 0 8px;
}
.cat-card {
  position: relative;
  display: grid; gap: 4px; justify-items: start; text-align: left;
  padding: 16px 16px 14px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: transform .16s ease, border-color .16s, box-shadow .16s;
}
.cat-card::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(140px 90px at 88% -10%, rgba(255, 107, 53, 0.16), transparent 70%);
  opacity: 0; transition: opacity .16s;
}
.cat-card:hover { transform: translateY(-2px); border-color: rgba(255, 107, 53, 0.45); }
.cat-card:hover::before { opacity: 1; }
.cat-card .cat-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; font-size: 21px;
  background: var(--surface-2); border: 1px solid var(--line);
  margin-bottom: 4px;
}
.cat-card .cat-name { font-weight: 800; font-size: 14.5px; line-height: 1.25; letter-spacing: -0.01em; }
.cat-card .cat-meta { font-size: 12px; color: var(--faint); font-weight: 600; }
.cat-card.is-active {
  background: linear-gradient(150deg, rgba(255, 107, 53, 0.2), rgba(255, 148, 64, 0.06) 65%), var(--surface);
  border-color: var(--accent);
  box-shadow: 0 10px 28px -14px rgba(255, 107, 53, 0.6);
}
.cat-card.is-active .cat-icon { background: var(--grad); border-color: transparent; }
.cat-card.is-active .cat-meta { color: var(--muted); }

/* CTA «нет нужной игры» */
.game-request-cta {
  margin-top: 22px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; flex-wrap: wrap;
  background:
    radial-gradient(400px 160px at 95% 0%, rgba(255, 107, 53, 0.12), transparent 70%),
    var(--surface);
}

@media (max-width: 640px) {
  .cat-cards { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 9px; }
  .cat-card { padding: 13px; }
  .cat-card .cat-icon { width: 36px; height: 36px; font-size: 18px; }
}

/* ── Страница пополнения Steam ── */

.steam-hero {
  margin-top: 20px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 24px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background:
    radial-gradient(480px 200px at 0% 0%, rgba(43, 107, 255, 0.22), transparent 70%),
    radial-gradient(420px 200px at 100% 100%, rgba(255, 107, 53, 0.10), transparent 70%),
    var(--surface);
}
.steam-hero-icon {
  width: 72px; height: 72px; border-radius: 20px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2a475e, #0f1b26);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow);
}
.steam-hero h1 { font-size: clamp(20px, 3vw, 28px); }
.steam-hero p { color: var(--muted); margin-top: 5px; max-width: 520px; font-size: 13.5px; }

/* ── Тумблер темы ── */

.theme-switch {
  position: relative;
  width: 64px; height: 32px; flex: none;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line-strong);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px;
  transition: border-color .15s;
}
.theme-switch:hover { border-color: var(--accent); }
.theme-switch .ts-icon { font-size: 13px; line-height: 1; z-index: 1; opacity: .45; transition: opacity .2s; }
.theme-switch .ts-knob {
  position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 2px 8px -2px rgba(255, 107, 53, 0.7);
  transition: transform .22s cubic-bezier(.5, 1.6, .4, 1);
}
/* тёмная тема — ползунок на луне (справа), светлая — на солнце (слева) */
html[data-theme="dark"] .theme-switch .ts-knob { transform: translateX(32px); }
html[data-theme="dark"] .theme-switch .ts-icon:first-of-type { opacity: .8; }
html[data-theme="light"] .theme-switch .ts-icon:last-of-type { opacity: .8; }

/* Сообщения от службы поддержки в чатах */
.chat-msg.from-support {
  background: rgba(255, 194, 75, 0.10);
  border: 1px solid rgba(255, 194, 75, 0.45);
  align-self: flex-start;
}
.chat-msg.from-support .m-meta { color: var(--warn); }

/* ── Чат в стиле мессенджера ── */

.msg-row { display: flex; }
.msg-row.mine { justify-content: flex-end; }
.msg-row.chained { margin-top: -6px; }

.msg-bubble {
  max-width: 78%;
  padding: 8px 12px 5px;
  border-radius: 16px;
  font-size: 14px; line-height: 1.45;
  word-break: break-word;
}
.msg-row.theirs .msg-bubble {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}
.msg-row.mine .msg-bubble {
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.92), rgba(240, 90, 23, 0.92));
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 14px -6px rgba(255, 107, 53, 0.55);
}
html[data-theme="light"] .msg-row.mine .msg-bubble { color: #fff; }

.msg-bubble.from-support {
  background: rgba(255, 194, 75, 0.10);
  border: 1px solid rgba(255, 194, 75, 0.45);
}

.msg-name { font-size: 11.5px; font-weight: 800; color: var(--accent-2); margin-bottom: 2px; }
.msg-name.support { color: var(--warn); }
.msg-text { white-space: pre-line; }

.msg-meta {
  display: flex; justify-content: flex-end; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 600;
  margin-top: 2px;
  color: var(--faint);
}
.msg-row.mine .msg-meta { color: rgba(255, 255, 255, 0.75); }
.msg-ticks { font-size: 11px; letter-spacing: -2px; }
.msg-ticks.read { color: #9bffd0; }
.msg-row.theirs .msg-ticks.read { color: var(--good); }

.msg-system {
  display: flex; justify-content: center;
  margin: 4px 0;
}
.msg-system span {
  max-width: 88%;
  text-align: center;
  font-size: 11.5px; font-weight: 600;
  color: var(--faint);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 5px 12px;
  border-radius: 999px;
}

/* ── Панель поддержки: крупные кнопки-действия ── */

.action-list { display: grid; gap: 8px; }
.action-btn {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 12px 14px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  transition: border-color .15s, background .15s;
}
.action-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--surface-2); }
.action-btn:disabled { opacity: .45; cursor: not-allowed; }
.action-btn .a-icon {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-size: 17px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.action-btn.good .a-icon { background: rgba(61, 214, 140, 0.12); }
.action-btn.bad .a-icon { background: rgba(255, 92, 92, 0.12); }
.action-btn.warn .a-icon { background: rgba(255, 194, 75, 0.12); }
.action-btn .a-title { font-weight: 800; font-size: 13.5px; }
.action-btn .a-sub { font-size: 11.5px; color: var(--faint); font-weight: 600; margin-top: 1px; }

/* Подвал всегда прижат к низу экрана */
body { display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; width: 100%; }
.site-footer { margin-top: auto; }

/* Баннер техподдержки в Telegram */
.tg-banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px 18px;
  border-radius: var(--r);
  border: 1px solid rgba(42, 171, 238, 0.35);
  background:
    radial-gradient(360px 140px at 0% 50%, rgba(42, 171, 238, 0.12), transparent 70%),
    var(--surface);
  margin-bottom: 18px;
}
.tg-banner .tg-icon {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2aabee, #1f8fd0);
  color: #fff;
}
.tg-banner .tg-title { font-weight: 800; font-size: 14.5px; }
.tg-banner .tg-sub { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.tg-banner .btn { margin-left: auto; }
@media (max-width: 640px) { .tg-banner .btn { margin-left: 0; width: 100%; } }

/* ── Юридические страницы ── */

.legal-layout {
  display: grid; grid-template-columns: 230px 1fr; gap: 26px;
  align-items: start; padding-bottom: 60px;
}
.legal-toc {
  position: sticky; top: calc(var(--header-h) + 16px);
  display: grid; gap: 2px;
  font-size: 13px;
}
.legal-toc a {
  padding: 7px 12px; border-radius: 8px;
  color: var(--muted); font-weight: 600;
  border-left: 2px solid var(--line);
}
.legal-toc a:hover { color: var(--text); background: var(--surface-2); border-left-color: var(--accent); }
.legal-toc .toc-label {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  color: var(--faint); padding: 0 12px 6px;
}

.legal-body { max-width: 760px; }
.legal-body .panel { padding: 28px 30px; }
.legal-updated { font-size: 12.5px; color: var(--faint); font-weight: 600; margin-top: 6px; }
.legal-body h2 {
  font-size: 17px; margin: 26px 0 10px;
  padding-top: 18px; border-top: 1px solid var(--line);
}
.legal-body h2:first-of-type { margin-top: 8px; border-top: none; padding-top: 0; }
.legal-body p, .legal-body li { color: var(--muted); font-size: 14px; line-height: 1.65; }
.legal-body p { margin: 8px 0; }
.legal-body ul, .legal-body ol { margin: 8px 0 8px 20px; display: grid; gap: 5px; }
.legal-body strong { color: var(--text); }
.legal-body a { color: var(--accent-2); font-weight: 600; }
.legal-body a:hover { text-decoration: underline; }
.legal-note {
  margin-top: 14px; padding: 12px 15px;
  border-radius: var(--r-sm); font-size: 13px; font-weight: 600;
  background: rgba(255, 107, 53, 0.08); border: 1px solid rgba(255, 107, 53, 0.3);
  color: var(--muted);
}

@media (max-width: 900px) {
  .legal-layout { grid-template-columns: 1fr; }
  .legal-toc { position: static; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .legal-toc .toc-label { grid-column: 1 / -1; }
}

/* ═════════════════════ МОБИЛЬНАЯ ВЕРСИЯ ═════════════════════
   Не «ужатый десктоп», а естественные мобильные паттерны:
   нижний таб-бар, конфигуратор первым, модалки-шторки,
   категории горизонтальной лентой, чаты на всю высоту. */

/* Нижний таб-бар (скрыт на десктопе) */
.bottom-nav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 150;
  background: var(--topbar-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav a {
  flex: 1;
  display: grid; justify-items: center; gap: 3px;
  padding: 5px 2px;
  border-radius: 10px;
  color: var(--faint);
  font-size: 10.5px; font-weight: 700;
}
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a.is-active { color: var(--accent); }
.bottom-nav a:active { background: var(--surface-2); }

@media (max-width: 860px) {
  /* базовая рамка */
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .bottom-nav { display: flex; }
  .burger, .mobile-nav { display: none !important; }
  .container { width: min(1200px, 100% - 24px); }
  :root { --header-h: 58px; }
  .topbar-inner { gap: 10px; }
  .brand-logo { width: 34px; height: 34px; }
  .brand-name { font-size: 14px; }
  .theme-switch { width: 56px; height: 28px; }
  .theme-switch .ts-knob { width: 20px; height: 20px; }
  html[data-theme="dark"] .theme-switch .ts-knob { transform: translateX(30px); }
  .balance-chip { padding: 7px 11px; font-size: 12.5px; }
  .user-menu { position: fixed; left: 12px; right: 12px; top: calc(var(--header-h) + 8px); min-width: 0; }

  /* герой и главная */
  .hero { padding: 24px 0 12px; }
  .hero p { font-size: 14px; }
  .hero-search input { padding: 13px 96px 13px 42px; font-size: 14px; border-radius: 13px; }
  .hero-search .btn { padding-inline: 14px; }
  .hero-stats { gap: 16px 22px; margin-top: 22px; }
  .hero-stats article strong { font-size: 17px; }
  .hero-stats article span { font-size: 11.5px; }
  .games-grid { grid-template-columns: repeat(auto-fill, minmax(106px, 1fr)); grid-auto-rows: 82px; gap: 8px; }
  .game-tile { border-radius: 12px; }
  .game-tile .tile-body { padding: 9px 10px; }
  .game-tile .tile-title { font-size: 12.5px; }
  .game-tile .tile-meta { font-size: 10px; gap: 4px; }
  .game-request-cta { flex-direction: column; align-items: stretch; text-align: left; }
  .section-head h2 { font-size: 18px; }

  /* страница игры: категории горизонтальной лентой */
  .cat-cards {
    display: flex; overflow-x: auto; gap: 9px;
    margin-inline: -12px; padding: 4px 12px 8px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .cat-cards::-webkit-scrollbar { display: none; }
  .cat-card { min-width: 150px; scroll-snap-align: start; padding: 12px 13px; }
  .cat-card .cat-icon { width: 34px; height: 34px; font-size: 17px; }
  .game-hero { min-height: 0; margin-top: 14px; }
  .game-hero-inner { padding: 14px; gap: 12px; align-items: center; }
  .game-hero-cover { width: 72px; border-radius: 12px; }
  .game-hero-badges { gap: 6px; margin-top: 8px; }
  .game-hero-badges .badge { font-size: 11px; padding: 4px 8px; }
  .offers-toolbar { gap: 8px; }
  .offers-toolbar .input, .offers-toolbar .select { max-width: none; flex: 1 1 46%; }
  .offers-toolbar .toolbar-spacer { display: none; }
  .offers-toolbar > .btn { flex: 1 1 100%; }

  /* карточка товара: покупка — первым экраном */
  .offer-layout { display: flex; flex-direction: column; gap: 14px; padding-bottom: 40px; }
  .offer-layout > aside.buy-card { order: -1; }
  .offer-head-cover { width: 64px; border-radius: 10px; }
  .offer-head h1 { font-size: 19px; }
  .crumbs { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: none; font-size: 12px; }
  .crumbs::-webkit-scrollbar { display: none; }
  .panel { padding: 16px; border-radius: 16px; }
  .buy-card { gap: 13px; }
  .qty-presets .chip { padding: 6px 11px; font-size: 12px; }

  /* заказ/тикет: чат во весь экран, панель — ниже */
  .order-layout { display: flex; flex-direction: column-reverse; gap: 14px; padding-bottom: 30px; }
  .chat-panel { min-height: 58dvh; max-height: none; }
  .msg-bubble { max-width: 88%; }

  /* модалки — шторки снизу */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    width: 100%; max-width: none;
    border-radius: 20px 20px 0 0;
    max-height: 88dvh;
    padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
    animation: sheet-up .24s ease;
  }
  .modal::before {
    content: ""; display: block;
    width: 42px; height: 4px; border-radius: 2px;
    background: var(--line-strong);
    margin: -6px auto 14px;
  }

  /* steam-виджет */
  .steam-hero { padding: 16px; gap: 12px; }
  .steam-hero-icon { width: 54px; height: 54px; border-radius: 14px; }
  .steam-hero > .btn { margin-left: 0; width: 100%; }
  .price-mode-switch { grid-template-columns: 1fr !important; }

  /* кабинеты и панели */
  .page-head { padding: 20px 0 6px; }
  .two-col { gap: 14px; }
  .tabs { margin-inline: -12px; padding-inline: 12px; }
  .stat-card { padding: 13px; }
  .stat-card .s-value { font-size: 17px; }
  .offer-row { padding: 13px 14px; gap: 4px 12px; }
  .offer-row .offer-title { font-size: 14px; }
  .listing-manage-row .lm-actions .btn { flex: 1; }
  .action-btn { padding: 11px 12px; }

  /* поиск и подсказки */
  .search-suggest { max-height: 56dvh; }

  /* юридические страницы */
  .legal-body .panel { padding: 20px 16px; }
  .legal-toc { gap: 6px; }

  /* футер компактнее */
  .footer-inner { padding: 24px 0 16px; gap: 18px; }
  .footer-cols { gap: 18px; }
}

@keyframes sheet-up {
  from { transform: translateY(40px); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}

@media (max-width: 400px) {
  .games-grid { grid-template-columns: repeat(3, 1fr); }
  .hero-tags .chip { padding: 6px 11px; font-size: 12px; }
}

/* Кнопки-номиналы на карточке товара */
.qty-nominals { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
.qty-nominals .nominal {
  display: grid; gap: 1px; justify-items: center;
  padding: 10px 8px; border-radius: 12px; white-space: normal; text-align: center;
}
.qty-nominals .nominal span { font-weight: 800; font-size: 13.5px; line-height: 1.2; }
.qty-nominals .nominal small { font-size: 11.5px; opacity: .75; font-weight: 700; }
.qty-nominals .nominal.is-active small { opacity: .9; }

/* ── Мобайл: доводка сетки игр и героя (перекрывает правила выше) ── */

@media (max-width: 860px) {
  /* 2 колонки: широкая плитка = аккуратный полноширинный баннер, дыр не бывает */
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 116px;
    gap: 9px;
  }
  .game-tile.t-p-big { grid-column: span 1; grid-row: span 2; } /* витринные — как обычные */
  .game-tile.t-sq { grid-column: span 2; grid-row: span 2; }
  .game-tile.t-land { grid-column: span 2; grid-row: span 2; }
  .game-tile.t-p-big .tile-title, .game-tile.t-sq .tile-title { font-size: 14px; }
  .game-tile .tile-title { font-size: 13px; }
  .game-tile .tile-body { padding: 10px 12px; }
  .game-tile.t-sq .tile-body, .game-tile.t-land .tile-body { padding: 12px 14px; }

  /* герой: компактнее */
  .hero h1 { font-size: 22px; max-width: none; }
  .hero p { font-size: 13px; margin-top: 8px; }
  .hero-search { margin-top: 16px; }

  /* чипы — одна строка с горизонтальной прокруткой */
  .hero-tags {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 12px -12px 0;
    padding: 2px 12px 6px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .hero-tags::-webkit-scrollbar { display: none; }
  .hero-tags .chip { flex: none; padding: 7px 13px; font-size: 12.5px; }

  /* статистика — компактная сетка 2×2 в одну строку каждая */
  .hero-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 16px;
    margin-top: 14px;
  }
  .hero-stats article { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
  .hero-stats article strong { font-size: 15px; flex: none; }
  .hero-stats article span { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

@media (max-width: 400px) {
  .games-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Мобайл: правки по фидбеку (перекрывают блок выше) ── */
@media (max-width: 860px) {
  /* герой: вернуть нормальный размер заголовка и подводки */
  .hero h1 { font-size: clamp(25px, 6.4vw, 32px); }
  .hero p { font-size: 14.5px; margin-top: 10px; }
  .hero-search { margin-top: 18px; }

  /* чипы: все видны сразу, без прокрутки, но компактные */
  .hero-tags {
    flex-wrap: wrap;
    overflow-x: visible;
    margin: 14px 0 0;
    padding: 0;
  }
  .hero-tags .chip { padding: 7px 13px; font-size: 12.5px; }

  /* статистика: чуть больше воздуха */
  .hero-stats { gap: 9px 18px; margin-top: 18px; }
  .hero-stats article strong { font-size: 16px; }
  .hero-stats article span { font-size: 11.5px; }

  /* телеграм-плашка на поддержке — в самый низ, чтобы не путали с основной */
  body[data-nav="support"] main.container { display: flex; flex-direction: column; }
  body[data-nav="support"] .tg-banner { order: 99; margin: 18px 0 6px; }
}

/* ── Мобайл: фиксы по фидбеку №2 ── */
@media (max-width: 860px) {
  /* Пополнение Steam: пошагово — сначала выбор валюты и номинала, оплата в конце */
  .steam-flow > aside.buy-card { order: 0; }

  /* Тумблер темы: вернуть полный размер, мини-версия ломала геометрию */
  .theme-switch { width: 64px; height: 32px; padding: 0 8px; }
  .theme-switch .ts-knob { width: 24px; height: 24px; top: 3px; left: 3px; }
  html[data-theme="dark"] .theme-switch .ts-knob { transform: translateX(32px); }
}
