:root {
    --bg: #0b0d12;
    --panel: #14171f;
    --panel-2: #1b1f29;
    --panel-3: #232838;
    --text: #eef1f7;
    --muted: #9aa1b4;
    --brand: #2bd47a;
    --brand-ink: #04120a;
    --sale: #ff3d8b;
    --border: #262b38;
    --radius: 14px;
    --radius-lg: 18px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: none; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.page { padding-top: 28px; padding-bottom: 60px; min-height: 60vh; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
input, select, button { font-family: inherit; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(11,13,18,.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.site-header__inner { display: flex; align-items: center; gap: 20px; height: 70px; }
.logo { display: flex; flex-direction: column; line-height: 1.1; }
.logo__mark { font-weight: 800; letter-spacing: .5px; color: var(--brand); font-size: 20px; }
.logo__sub { font-size: 11px; color: var(--muted); }
.search { flex: 1; display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 0 14px; height: 44px; }
.search input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 15px; }
.search__icon { opacity: .6; }
.header-link { color: var(--muted); font-size: 14px; white-space: nowrap; }
.header-link:hover { color: var(--text); }

/* ---------- Catalog ---------- */
.section-title { font-size: 26px; font-weight: 800; margin: 8px 0 18px; }
.pills { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }
.pill { padding: 9px 16px; border-radius: 999px; background: var(--panel); border: 1px solid var(--border); color: var(--muted); font-size: 14px; }
.pill:hover { color: var(--text); }
.pill--active { background: #fff; color: #111; border-color: #fff; font-weight: 600; }

.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; }
.game-card { display: flex; flex-direction: column; gap: 8px; }
/* Квадрат, а не 4/3: обложки — иконки игр (512×512 из App Store, 480×480 с kupikod).
   В прямоугольнике их резало по высоте. */
.game-card__cover { aspect-ratio: 1/1; border-radius: var(--radius); overflow: hidden; position: relative; border: 1px solid var(--border); background: var(--panel-2); transition: transform .15s, border-color .15s; }
.game-card:hover .game-card__cover { transform: translateY(-3px); border-color: var(--brand); }
/* contain, а не cover: широкие картинки (например, header из Steam) впишутся целиком,
   а не обрежутся по краям. Квадратные заполняют плитку без полей. */
.game-card__cover img { width: 100%; height: 100%; object-fit: contain; display: block; }
.game-card__name { font-weight: 600; font-size: 14px; }
.game-card__from { color: var(--muted); font-size: 13px; }

/* Плейсхолдер обложки */
.cover--ph { display: flex; align-items: center; justify-content: center; }
.cover__initials { font-size: 34px; font-weight: 800; color: rgba(255,255,255,.85); letter-spacing: 1px; }

/* ---------- Panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.panel + .panel { margin-top: 20px; }
.panel__title { font-size: 20px; font-weight: 700; margin: 0 0 16px; }
.back { display: inline-block; margin: 4px 0 18px; color: var(--muted); }

/* ---------- Game page layout ---------- */
.game { display: grid; grid-template-columns: 1fr 360px; gap: 22px; align-items: start; }
.game__summary { position: sticky; top: 90px; }

/* ID panel */
.id-panel__head { display: flex; gap: 14px; align-items: flex-end; justify-content: space-between; }
.id-panel__title { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.id-input { width: 100%; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; color: var(--text); font-size: 18px; }
.id-panel__server { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; color: var(--muted); font-size: 13px; }
.id-panel__server select { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; color: var(--text); }
.id-panel__actions { display: flex; gap: 8px; flex: none; }

/* ---------- Модальное окно «Где взять UID» ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(4,6,10,.72); backdrop-filter: blur(2px); }
.modal__box { position: relative; width: 100%; max-width: 640px; max-height: calc(100vh - 40px); overflow: auto; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.modal__head { position: relative; padding: 18px 52px; border-bottom: 1px solid var(--border); text-align: center; }
.modal__title { margin: 0; font-size: 17px; font-weight: 700; }
.modal__icon { margin-right: 8px; }
.modal__close { position: absolute; top: 50%; right: 16px; transform: translateY(-50%); background: none; border: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 4px; }
.modal__close:hover { color: var(--text); }
.modal__body { padding: 20px; }
.modal__foot { padding: 0 20px 20px; }
.modal__foot .btn { width: 100%; }
body.is-modal-open { overflow: hidden; }

.uid-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 12px; font-size: 15px; }
.uid-steps li { padding-left: 4px; }
.uid-steps__text { display: block; }
/* Картинка к шагу — блоком под текстом пункта, поэтому span, а не div: <li> внутри <ol>. */
.uid-shot { display: block; margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.uid-steps .uid-shot { margin-top: 10px; }
.uid-shot img { display: block; width: 100%; height: auto; }
.uid-note { margin: 14px 0 0; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 14px; }
/* color кнопкой не наследуется (шрифт — да, см. правило input/select/button выше):
   без явного цвета текст плиток рисовался системным чёрным по тёмному фону. */
.tile { text-align: left; cursor: pointer; color: var(--text); background: var(--panel-2); border: 2px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 12px; min-height: 104px; transition: border-color .12s, background .12s; }
.tile:hover { border-color: #3a4256; background: var(--panel-3); }
.tile--active { border-color: var(--brand); background: #12271b; }
/* Названия номиналов бывают длинными («... Bulletproof Case (30d)») и без пробелов —
   переносим по любому месту, иначе строка вылезает за плитку. */
.tile__nominal { font-size: 15px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
/* Иконка номинала. Блока нет вовсе, если иконка не задана, — плитка тогда
   выглядит ровно как до появления иконок. */
.tile__icon { display: flex; justify-content: center; align-items: center; padding: 4px 0; }
.tile__icon img { max-width: 72px; max-height: 56px; width: auto; height: auto; object-fit: contain; }
.tile__prices { margin-top: auto; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.tile__price { font-size: 18px; font-weight: 800; color: var(--brand); }
.tile__old { color: var(--muted); text-decoration: line-through; font-size: 12px; }
.tile__badge { display: inline-block; background: var(--sale); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; width: fit-content; }

/* Summary */
.summary__head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.summary__cover { width: 54px; height: 54px; border-radius: 10px; overflow: hidden; flex: none; border: 1px solid var(--border); background: var(--panel-2); }
.summary__cover img { width: 100%; height: 100%; object-fit: contain; }
.summary__game { font-weight: 700; }
.summary__offer { color: var(--muted); font-size: 13px; }
.summary__tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.summary__label { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.pay-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.pay { cursor: pointer; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 8px; color: var(--muted); font-size: 13px; text-align: center; }
.pay--active { border-color: var(--brand); color: var(--text); background: #12271b; }
.summary__input { width: 100%; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; color: var(--text); margin-bottom: 14px; }
.summary__lines { border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.summary__line { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.summary__old.is-struck { text-decoration: line-through; color: var(--muted); }
.summary__total { display: flex; justify-content: space-between; align-items: center; margin: 16px 0; padding: 14px; background: var(--panel-2); border-radius: 12px; font-size: 20px; font-weight: 800; }
.summary__legal { margin-top: 12px; line-height: 1.4; }

/* Tags */
.tag { font-size: 11px; padding: 3px 9px; border-radius: 999px; background: var(--panel-3); color: var(--muted); }
.tag--light { background: #fff; color: #111; font-weight: 600; }
.tag--type { background: rgba(43,212,122,.15); color: var(--brand); }
.tag--sale { background: var(--sale); color: #fff; font-weight: 600; }

/* ---------- Buttons ---------- */
.btn { display: inline-block; padding: 12px 18px; border-radius: 10px; border: 1px solid transparent; font-size: 14px; cursor: pointer; text-align: center; }
.btn--primary { background: var(--brand); color: var(--brand-ink); border: none; font-weight: 700; }
.btn--primary:hover { filter: brightness(1.05); }
.btn--ghost { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); white-space: nowrap; }
.btn--buy { display: block; width: 100%; background: var(--brand); color: var(--brand-ink); border: none; font-size: 16px; font-weight: 800; padding: 15px; border-radius: 12px; }
.btn--buy:hover { filter: brightness(1.05); }
.link-btn { background: none; border: none; color: var(--brand); cursor: pointer; padding: 0; font-size: 13px; }
.inline-form { display: inline; }

.validate-result { font-size: 13px; min-height: 18px; margin-top: 10px; }
.validate-result.is-ok { color: var(--brand); }
.validate-result.is-bad { color: var(--sale); }

/* ---------- Order status ---------- */
.order-box { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 26px; max-width: 640px; }
.order-status { display: inline-block; padding: 6px 14px; border-radius: 999px; font-weight: 600; margin: 10px 0; background: var(--panel-3); }
.order-status--completed { background: rgba(43,212,122,.15); color: var(--brand); }
.order-status--error, .order-status--failed, .order-status--canceled, .order-status--refund { background: rgba(255,61,139,.15); color: var(--sale); }
.key-box { margin: 16px 0; padding: 16px; background: var(--panel-2); border-radius: 12px; }
.key-box__value { font-size: 18px; color: var(--brand); word-break: break-all; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 6px 16px; margin: 16px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- Stars ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 16px; margin: 20px 0; }
.card { display: flex; flex-direction: column; gap: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; color: var(--text); }
.card--form input { margin-top: 6px; width: 100%; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; color: var(--text); }
.card__title { font-weight: 600; }
.card__sub { color: var(--muted); font-size: 13px; }
.card__price { margin-top: auto; font-size: 18px; font-weight: 700; color: var(--brand); }
.stars-validate { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin: 16px 0; display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.stars-validate label { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 220px; color: var(--muted); }
.stars-validate input { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; color: var(--text); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 30px 0; }
.site-footer__inner { display: flex; gap: 40px; flex-wrap: wrap; align-items: flex-start; }
.site-footer__col { display: flex; flex-direction: column; gap: 8px; }
.site-footer__socials { margin-left: auto; display: flex; gap: 10px; }
.soc { width: 34px; height: 34px; border-radius: 50%; background: var(--panel-2); display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); }
.site-footer__legal { margin-top: 24px; }

/* ---------- Alerts ---------- */
.alert { padding: 10px 14px; border-radius: 10px; margin: 12px 0; border: 1px solid transparent; }
.alert--error { background: rgba(255,61,139,.12); border-color: var(--sale); color: #ffc4dd; }
.alert--success { background: rgba(43,212,122,.12); border-color: var(--brand); color: #b9f5da; }
.empty { padding: 40px 0; }

/* ---------- Pager ---------- */
.pager { display: flex; gap: 6px; flex-wrap: wrap; margin: 26px 0 0; }
.pager__item { padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); }
.pager__item.is-active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }

/* ---------- Admin (сохранено) ---------- */
.admin .topbar, .topbar--admin { background: var(--panel); border-bottom: 1px solid var(--border); }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { font-weight: 700; font-size: 18px; color: var(--text); }
.nav { display: flex; gap: 18px; align-items: center; }
.nav a { color: var(--muted); }
.nav a:hover { color: var(--text); }
.page-title { margin: 20px 0; }
.filters { display: flex; gap: 10px; margin: 16px 0; flex-wrap: wrap; }
.filters input, .filters select { background: var(--panel); border: 1px solid var(--border); color: var(--text); padding: 9px 12px; border-radius: 8px; }
.filters button { cursor: pointer; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 9px 14px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; }
.table input, .table select { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 6px 8px; }
.markup-form { display: flex; gap: 4px; align-items: center; }
.markup-form input { width: 60px; }
.pill--completed { }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 16px; margin: 20px 0; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat__label { color: var(--muted); font-size: 13px; }
.stat__value { font-size: 30px; font-weight: 800; margin: 6px 0; }
.stat__sub { color: var(--muted); font-size: 13px; }
.hint { background: var(--panel-2); border-radius: 8px; padding: 14px; margin: 20px 0; font-size: 14px; }
.badge { font-size: 10px; padding: 1px 6px; border-radius: 4px; background: var(--panel-3); color: var(--muted); }
.pill { }
.pill--submitted, .pill--processing { background: rgba(242,182,76,.15); color: #f2b64c; }
.pill--error, .pill--failed, .pill--canceled, .pill--refund { background: rgba(255,61,139,.15); color: var(--sale); }
.order-detail { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.actions { display: flex; gap: 10px; margin-top: 16px; }
.auth { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth__box { width: 100%; max-width: 360px; padding: 20px; }
.login-form { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.login-form label, .settings-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.login-form input, .settings-form input, .settings-form select { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); padding: 10px 12px; border-radius: 8px; }
.settings-form fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.settings-form legend { color: var(--muted); padding: 0 8px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 60px 20px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .game { grid-template-columns: 1fr; }
    .id-panel__head { flex-wrap: wrap; }
    .id-panel__head > div:first-child { flex: 1 1 100%; }
    .game__summary { position: static; }
    .site-header__inner { gap: 12px; }
    .header-link { display: none; }
}
