/* Локальные шрифты: Cabin используется для основного текста, DejaVu Sans — для заголовков. */
@font-face {
  font-family: "Kich Cabin";
  src: url("fonts/Cabin-Regular.otf") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Kich Cabin";
  src: url("fonts/Cabin-Medium.otf") format("opentype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Kich Cabin";
  src: url("fonts/Cabin-SemiBold.otf") format("opentype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Kich Cabin";
  src: url("fonts/Cabin-Bold.otf") format("opentype");
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
}
@font-face {
  font-family: "Kich Display";
  src: url("fonts/DejaVuSans-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 500 900;
  font-display: swap;
}

:root {
  --bg: #090812;
  --bg-soft: #100d1c;
  --surface: #151125;
  --surface-2: #1c1730;
  --surface-3: #241d3c;
  --line: rgba(178, 148, 255, .16);
  --text: #f7f3ff;
  --muted: #a69bbd;
  --purple: #a855f7;
  --purple-2: #7c3aed;
  --cyan: #45e6f4;
  --pink: #f15bce;
  --success: #55e6a5;
  --danger: #ff668b;
  --warning: #ffc86b;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 60px rgba(0,0,0,.35);
  --glow-purple: 0 0 28px rgba(168,85,247,.22);
  --font-body: "Kich Cabin", system-ui, sans-serif;
  --font-display: "Kich Display", "Kich Cabin", sans-serif;
  --content: 1180px;
}
* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; color: var(--text); font-family: var(--font-body);
  background:
    radial-gradient(ellipse at 12% 0%, rgba(116,50,194,.20), transparent 34rem),
    radial-gradient(ellipse at 92% 18%, rgba(35,183,206,.10), transparent 30rem),
    var(--bg);
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 46px; padding: 0 18px; border: 1px solid transparent; border-radius: 12px;
  color: #fff; font-weight: 800; cursor: pointer; transition: .2s ease;
}
.button-primary, button[data-action="buy"], button[data-action="confirm"], button[data-action="topup"] {
  background: linear-gradient(110deg, var(--purple-2), var(--purple) 58%, #6d5dfc);
  box-shadow: 0 8px 26px rgba(124,58,237,.25);
}
.button-primary:hover, button[data-action="buy"]:hover, button[data-action="confirm"]:hover, button[data-action="topup"]:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(124,58,237,.38); }
.button-ghost { background: rgba(255,255,255,.035); border-color: var(--line); color: var(--text); }
.button-cyan { background: rgba(69,230,244,.10); color: var(--cyan); border-color: rgba(69,230,244,.28); }
.button-danger { background: rgba(255,102,139,.10); color: var(--danger); border-color: rgba(255,102,139,.24); }
button:disabled, .is-disabled { opacity: .48; cursor: not-allowed; }
.container { width: min(var(--content), calc(100% - 40px)); margin: 0 auto; }
.site-header { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); background: rgba(9,8,18,.82); backdrop-filter: blur(18px); }
.header-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-family: var(--font-display); font-size: 19px; font-weight: 800; letter-spacing: .04em; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: linear-gradient(135deg, var(--purple), #4631a8 65%, var(--cyan)); box-shadow: var(--glow-purple); }
.brand span:last-child { background: linear-gradient(90deg, #fff, #c99cff 58%, var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { display: flex; align-items: center; gap: 25px; color: var(--muted); font-size: 13px; font-weight: 700; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.balance-chip { padding: 10px 13px; border: 1px solid rgba(69,230,244,.2); border-radius: 12px; color: var(--cyan); background: rgba(69,230,244,.06); font-size: 13px; font-weight: 800; }
main { padding: 38px 0 80px; }
.eyebrow { color: var(--cyan); text-transform: uppercase; letter-spacing: .18em; font-size: 10px; font-weight: 800; }
h1,h2,h3,p { margin-top: 0; }
h1,h2,h3 { letter-spacing: -.035em; }
h1 { margin-bottom: 12px; font-size: clamp(32px, 5vw, 56px); line-height: 1.05; }
h2 { font-size: clamp(24px, 3vw, 34px); }
h3 { font-size: 17px; }
.muted { color: var(--muted); }
.gradient-text { background: linear-gradient(90deg, #d6a8ff, #fff 50%, var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero { position: relative; overflow: hidden; min-height: 350px; padding: clamp(28px, 6vw, 62px); display: flex; align-items: center; border: 1px solid var(--line); border-radius: 28px; background: linear-gradient(110deg, rgba(33,22,58,.97), rgba(17,16,36,.88) 60%, rgba(13,36,49,.75)); box-shadow: var(--shadow); }
.hero:after { content: ""; position: absolute; width: 360px; height: 360px; right: 5%; top: -30px; border-radius: 50%; border: 1px solid rgba(69,230,244,.16); box-shadow: 0 0 0 28px rgba(69,230,244,.025), 0 0 0 58px rgba(168,85,247,.035), inset 0 0 70px rgba(69,230,244,.08); }
.hero-content { position: relative; z-index: 1; max-width: 610px; }
.hero p { max-width: 500px; color: #bdb2d1; line-height: 1.7; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.section { margin-top: 54px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.section-head p { margin: 0; color: var(--muted); font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(155deg, rgba(29,23,48,.96), rgba(17,14,29,.98)); box-shadow: 0 10px 30px rgba(0,0,0,.16); }
.card-body { padding: 18px; }
.game-cover, .product-image { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; background: linear-gradient(135deg, #35205c, #142a40); }
.game-cover { aspect-ratio: 16/10; }
.image-placeholder { display: grid; place-items: center; color: rgba(255,255,255,.7); font-family: var(--font-display); font-size: 12px; letter-spacing: .12em; background: radial-gradient(circle at 70% 30%, rgba(69,230,244,.22), transparent 35%), linear-gradient(135deg, #35205c, #121827 70%); }
.card-title-row { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.card-title-row h3 { margin-bottom: 6px; }
.platforms, .tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.tag { padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; color: #c8bddb; font-size: 10px; font-weight: 800; }
.tag-cyan { border-color: rgba(69,230,244,.24); color: var(--cyan); background: rgba(69,230,244,.06); }
.tag-purple { border-color: rgba(168,85,247,.3); color: #d5b3ff; background: rgba(168,85,247,.08); }
.price { color: var(--cyan); font-size: 22px; font-weight: 800; }
.product-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.product-meta .muted { font-size: 12px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin: 24px 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab { padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: rgba(255,255,255,.025); font-size: 12px; font-weight: 800; }
.tab[aria-selected="true"] { color: var(--cyan); border-color: rgba(69,230,244,.34); background: rgba(69,230,244,.08); }
.product-layout { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(320px,.9fr); gap: 26px; align-items: start; }
.product-visual { overflow: hidden; border: 1px solid var(--line); border-radius: 22px; }
.product-visual .product-image { aspect-ratio: 4/3; }
.product-info { padding: 26px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); }
.plan-list { display: grid; gap: 10px; margin: 18px 0; }
.plan { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.025); }
.plan input { accent-color: var(--purple); }
.plan:has(input:checked) { border-color: rgba(168,85,247,.65); background: rgba(168,85,247,.09); }
.stock { color: var(--success); font-size: 11px; font-weight: 800; }
.stock-out { color: var(--danger); }
.form-shell { width: min(460px, 100%); margin: 24px auto; padding: clamp(22px, 5vw, 34px); border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(150deg, rgba(31,24,51,.98), rgba(16,14,28,.98)); box-shadow: var(--shadow); }
.form-shell h1 { font-size: 30px; }
.form-field { display: grid; gap: 8px; margin: 16px 0; }
.form-field label { color: #c9bfd8; font-size: 12px; font-weight: 800; }
.form-field input, .form-field select { width: 100%; min-height: 48px; padding: 0 14px; outline: none; color: var(--text); border: 1px solid var(--line); border-radius: 11px; background: #0e0b18; }
.form-field input:focus, .form-field select:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(168,85,247,.12); }
.form-note { color: var(--muted); font-size: 12px; line-height: 1.6; }
.form-shell .button, .form-shell button { width: 100%; margin-top: 8px; }
.inline-link { color: var(--cyan); font-weight: 800; }
.alert { margin: 14px 0; padding: 12px 14px; border: 1px solid; border-radius: 11px; font-size: 12px; line-height: 1.5; }
.alert-error { color: #ff9bb2; border-color: rgba(255,102,139,.25); background: rgba(255,102,139,.07); }
.alert-success { color: var(--success); border-color: rgba(85,230,165,.25); background: rgba(85,230,165,.07); }
.alert-info { color: var(--cyan); border-color: rgba(69,230,244,.2); background: rgba(69,230,244,.06); }
.state-box { padding: 28px 18px; border: 1px dashed rgba(178,148,255,.25); border-radius: 16px; text-align: center; background: rgba(255,255,255,.02); }
.state-box strong { display: block; margin-bottom: 7px; }
.state-box p { margin: 0; color: var(--muted); font-size: 13px; }
.state-box[data-state="loading"] { color: var(--cyan); }
.state-box[data-state="error"] { border-color: rgba(255,102,139,.3); }
.state-box[hidden] { display: none; }
.profile-grid { display: grid; grid-template-columns: 280px minmax(0,1fr); gap: 20px; }
.profile-card { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.avatar { width: 58px; height: 58px; display: grid; place-items: center; margin-bottom: 16px; border-radius: 18px; color: white; font-family: var(--font-display); font-size: 20px; background: linear-gradient(135deg, var(--purple), #4d3bb2, var(--cyan)); }
.stat-value { margin: 8px 0 20px; color: var(--cyan); font-size: 28px; font-weight: 800; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th,td { padding: 15px 16px; border-bottom: 1px solid var(--line); text-align: left; font-size: 12px; }
th { color: var(--muted); background: rgba(255,255,255,.025); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
tr:last-child td { border-bottom: 0; }
.key-value { display: inline-block; max-width: 180px; overflow: hidden; color: var(--cyan); font-family: monospace; text-overflow: ellipsis; vertical-align: middle; }
.modal-card { width: min(480px, 100%); margin: 40px auto; padding: 26px; border: 1px solid rgba(168,85,247,.32); border-radius: 22px; background: #171229; box-shadow: 0 0 80px rgba(0,0,0,.65), var(--glow-purple); }
.modal-backdrop { position: fixed; inset: 0; z-index: 50; overflow-y: auto; padding: 1px 20px; background: rgba(4,3,10,.78); backdrop-filter: blur(8px); }
.summary-line { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 13px; }
.summary-line strong { color: var(--text); }
.summary-line.total { color: var(--text); font-size: 16px; font-weight: 800; }
.footer { padding: 30px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* Состояния авторизации и статусы заказов */
.header-user { display: flex; align-items: center; gap: 10px; }
[data-auth][hidden] { display: none !important; }
.tag[data-status="success"], .tag[data-status="paid"], .tag[data-status="completed"] {
  color: var(--success); border-color: rgba(85,230,165,.3); background: rgba(85,230,165,.08);
}
.tag[data-status="pending"], .tag[data-status="waiting"], .tag[data-status="processing"] {
  color: var(--warning); border-color: rgba(255,200,107,.3); background: rgba(255,200,107,.08);
}
.tag[data-status="error"], .tag[data-status="failed"], .tag[data-status="cancelled"] {
  color: var(--danger); border-color: rgba(255,102,139,.3); background: rgba(255,102,139,.08);
}
.plan[data-in-stock="false"] { opacity: .58; }
.plan[data-in-stock="false"] .stock { color: var(--danger); }

@media (max-width: 850px) {
  .nav { display: none; }
  .grid-4 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .product-layout { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .container { width: min(100% - 28px, var(--content)); }
  .header-inner { min-height: 66px; }
  .brand { font-size: 16px; }
  .header-actions .button { min-height: 40px; padding: 0 11px; font-size: 11px; }
  .balance-chip { display: none; }
  main { padding-top: 24px; }
  .hero { min-height: 320px; border-radius: 20px; }
  .hero:after { right: -190px; opacity: .6; }
  .grid, .grid-4 { grid-template-columns: 1fr; }
  .section { margin-top: 38px; }
  .section-head { align-items: start; flex-direction: column; }
  .product-info { padding: 20px; }
  .list-row { align-items: start; }
}

/* Атрибут hidden всегда скрывает элемент (пункт 11 ТЗ) */
[hidden] {
  display: none !important;
}
