:root {
  --bg: #f2f4f7; --panel: #ffffff; --panel2: #f2f4f7; --line: #e4e7ec; --text: #101828; --muted: #667085;
  --accent: #2e6bff; --accent2: #1f56e0; --accent-soft: #e8efff; --green: #12b76a; --green-soft: #e7f8f0;
  --red: #f04438; --red-soft: #fdecea; --yellow: #f79009; --yellow-soft: #fef4e6; --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px rgba(16, 24, 40, .04);
  --shadow-hover: 0 8px 24px rgba(16, 24, 40, .1);
}
:root[data-theme="dark"] {
  --bg: #0f1115; --panel: #181b21; --panel2: #22262e; --line: #2c313a; --text: #eef0f3; --muted: #8a93a3;
  --accent-soft: #1d2a4d; --green-soft: #0f2a1f; --red-soft: #3a1a18; --yellow-soft: #3a2a12;
  --shadow: none; --shadow-hover: 0 8px 24px rgba(0, 0, 0, .4);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
h1 { font-size: 28px; margin: 24px 0 16px; letter-spacing: -.02em; } h2 { font-size: 20px; margin: 28px 0 14px; letter-spacing: -.01em; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.link { color: var(--accent); font-weight: 500; }

/* header */
.top { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-in { display: flex; gap: 14px; align-items: center; height: 68px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; white-space: nowrap; letter-spacing: -.02em; }
.logo i { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #4d84ff, #2e6bff 60%, #1f4fd1); display: grid; place-items: center; font-style: normal; color: #fff; font-size: 18px; }
.catbtn { background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 600; white-space: nowrap; }
.catbtn:hover { background: var(--accent2); }
.search { flex: 1; position: relative; }
.search input { width: 100%; padding-left: 40px; height: 44px; border-radius: 12px; background: var(--panel2); border-color: transparent; }
.search::before { content: "⌕"; position: absolute; left: 14px; top: 50%; transform: translateY(-52%); font-size: 20px; color: var(--muted); }
nav { display: flex; gap: 4px; align-items: center; }
nav a, nav button.navbtn { padding: 8px 12px; border-radius: 10px; color: var(--muted); white-space: nowrap; font-weight: 500; background: none; border: 0; font: inherit; cursor: pointer; }
nav a:hover, nav a.on, nav button.navbtn:hover { color: var(--text); background: var(--panel2); }
.bal { color: var(--text) !important; background: var(--panel2); font-weight: 700 !important; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-grid; place-items: center; font-weight: 700; text-transform: uppercase; }

/* forms */
input, select, textarea { background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 10px 14px; font: inherit; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 100px; resize: vertical; }
label { display: block; margin-bottom: 14px; } label > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--accent); color: #fff; border: 0; border-radius: 12px; padding: 11px 18px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s; }
.btn:hover { background: var(--accent2); } .btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: var(--panel2); color: var(--text); } .btn.ghost:hover { background: var(--line); }
.btn.green { background: var(--green); } .btn.red { background: var(--red); } .btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn.lg { padding: 14px 22px; font-size: 16px; width: 100%; }

/* surfaces */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; }
.gicon { border-radius: 22%; object-fit: cover; flex: none; display: block; background: var(--panel2); }
.gicon.ph { display: grid; place-items: center; color: #fff; font-weight: 800; }

/* hero */
.hero { position: relative; overflow: hidden; background: linear-gradient(120deg, #2e6bff 0%, #5b8cff 55%, #8fb0ff 100%); color: #fff; border-radius: 24px; padding: 36px 40px; margin-top: 24px; }
.hero h1 { margin: 0 0 8px; font-size: 34px; } .hero p { margin: 0 0 20px; opacity: .92; max-width: 560px; }
.hero .perks { display: flex; gap: 10px; flex-wrap: wrap; }
.hero .perks span { background: rgba(255, 255, 255, .18); padding: 6px 12px; border-radius: 999px; font-size: 14px; backdrop-filter: blur(4px); }
.hero .art { position: absolute; right: 28px; top: 50%; transform: translateY(-50%); display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; opacity: .95; }
.hero .art img { width: 76px; height: 76px; border-radius: 20px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.hero .art img:nth-child(2n) { transform: translateY(18px); }

/* popular row */
.pop { display: flex; gap: 18px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: thin; }
.pop a { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 84px; flex: none; text-align: center; font-size: 13px; font-weight: 500; }
.pop a img, .pop a .gicon { width: 72px; height: 72px; transition: transform .15s; box-shadow: var(--shadow); }
.pop a:hover img { transform: translateY(-3px); }
.pop a span { line-height: 1.25; }

/* catalog tiles */
.games { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.game { display: flex; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; transition: .15s; box-shadow: var(--shadow); }
.game:hover { box-shadow: var(--shadow-hover); border-color: transparent; }
.game .gicon { width: 64px; height: 64px; }
.game b { display: block; font-size: 16px; }
.subs { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 13px; }
.subs a { color: var(--muted); } .subs a:hover { color: var(--accent); }

/* tabs & chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.chip { padding: 8px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--text); cursor: pointer; font-weight: 500; font-size: 14px; white-space: nowrap; }
.chip:hover { border-color: var(--accent); } .chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip i { font-style: normal; opacity: .55; margin-left: 6px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 12px 0; } .toolbar select, .toolbar input { width: auto; }
.sechead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* product cards */
.products { grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); }
.pcard { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; gap: 10px; transition: .15s; box-shadow: var(--shadow); min-height: 200px; }
.pcard:hover { box-shadow: var(--shadow-hover); border-color: transparent; transform: translateY(-2px); }
.pcard .ph-top { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-width: 0; }
.pcard .ph-top .gicon { width: 28px; height: 28px; border-radius: 8px; }
.pcard .ph-top span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .t { font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; flex: 1; }
.pcard .price { font-size: 20px; }
.pcard .pbot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
.pcard .pbot .who { display: flex; align-items: center; gap: 6px; min-width: 0; } .pcard .pbot .who b { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .avatar { width: 24px; height: 24px; font-size: 12px; }
.price { font-weight: 800; white-space: nowrap; letter-spacing: -.01em; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 3px 8px; border-radius: 8px; background: var(--panel2); color: var(--muted); }
.tag.auto, .tag.completed, .tag.paid-out { color: var(--green); background: var(--green-soft); }
.tag.paid, .tag.pending { color: var(--yellow); background: var(--yellow-soft); }
.tag.disputed, .tag.rejected { color: var(--red); background: var(--red-soft); }

/* lists (orders) */
.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; box-shadow: var(--shadow); }
.item:hover { box-shadow: var(--shadow-hover); }
.item .gicon { width: 44px; height: 44px; border-radius: 12px; }
.item .body { flex: 1; min-width: 0; } .item .t { font-weight: 600; }

/* game page header */
.ghead { display: flex; align-items: center; gap: 18px; margin: 24px 0 8px; }
.ghead .gicon { width: 88px; height: 88px; box-shadow: var(--shadow); }
.ghead h1 { margin: 0 0 4px; }
.crumbs { font-size: 13px; color: var(--muted); margin-top: 20px; } .crumbs a:hover { color: var(--accent); }

/* listing page */
.cols { display: grid; grid-template-columns: 1fr 360px; gap: 18px; align-items: start; }
.sticky { position: sticky; top: 88px; }
.lhead { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; } .lhead .gicon { width: 64px; height: 64px; }
.seller { display: flex; gap: 12px; align-items: center; } .seller .avatar { width: 44px; height: 44px; font-size: 18px; }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; } .kv:last-child { border: 0; }
.desc { white-space: pre-wrap; }
.stars { color: var(--yellow); }
.guarantee { display: flex; gap: 10px; align-items: flex-start; background: var(--green-soft); color: var(--text); border-radius: 12px; padding: 12px; font-size: 13px; margin-top: 14px; }

/* stats / tables */
.stats { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.stat b { display: block; font-size: 24px; letter-spacing: -.02em; } .stat.hl { background: linear-gradient(135deg, #2e6bff, #5b8cff); color: #fff; border: 0; } .stat.hl .muted { color: rgba(255, 255, 255, .85); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; } th { color: var(--muted); font-weight: 500; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.tablewrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tablewrap input, .tablewrap select { padding: 7px 10px; border-radius: 10px; }
.tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 4px; margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 8px 14px; color: var(--muted); border-radius: 10px; white-space: nowrap; font-weight: 500; } .tabs a.on { color: #fff; background: var(--accent); }

/* chat */
.chat { display: flex; flex-direction: column; gap: 8px; height: 420px; overflow-y: auto; padding: 4px; margin-bottom: 12px; }
.msg { background: var(--panel2); padding: 9px 13px; border-radius: 14px 14px 14px 4px; max-width: 78%; white-space: pre-wrap; word-break: break-word; }
.msg.me { align-self: flex-end; background: var(--accent); color: #fff; border-radius: 14px 14px 4px 14px; } .msg.me .who { color: rgba(255, 255, 255, .8); }
.msg.sys { align-self: center; background: var(--accent-soft); color: var(--text); font-size: 13px; max-width: 100%; text-align: center; border-radius: 12px; }
.msg .who { font-size: 12px; color: var(--muted); }
.secret { background: var(--green-soft); border: 1px solid var(--green); border-radius: 12px; padding: 12px; white-space: pre-wrap; font-family: ui-monospace, Consolas, monospace; word-break: break-all; }

.auth { max-width: 400px; margin: 48px auto; }
.row { display: flex; gap: 10px; flex-wrap: wrap; } .row > * { flex: 1; min-width: 140px; }
.empty { text-align: center; padding: 48px; color: var(--muted); }
.foot { color: var(--muted); font-size: 13px; padding: 48px 16px; text-align: center; }
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--panel); color: var(--text); box-shadow: var(--shadow-hover); border-left: 4px solid var(--green); padding: 12px 16px; border-radius: 12px; max-width: 340px; }
.toast.err { border-left-color: var(--red); }

@media (max-width: 960px) { .hero .art { display: none; } }
@media (max-width: 1180px) {
  .top-in { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; row-gap: 10px; }
  .search { order: 3; flex-basis: 100%; } nav { margin-left: auto; }
}
@media (max-width: 820px) {
  .cols { grid-template-columns: 1fr; } .sticky { position: static; }
  .top-in { flex-wrap: wrap; height: auto; padding: 10px 16px; } .search { order: 3; flex-basis: 100%; } .catbtn { display: none; }
  nav { margin-left: auto; overflow-x: auto; }
  .hero { padding: 26px 22px; } .hero h1 { font-size: 26px; }
  .products { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* profile */
.avatar.big { width: 84px; height: 84px; font-size: 36px; flex: none; }
.profile { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
a.stat:hover { box-shadow: var(--shadow-hover); }

.paybadge { margin-top: 14px; } .paybadge img { height: 40px; width: auto; border-radius: 6px; }
