:root {
  color-scheme: dark;
  --bg: #0a0d12;
  --panel: #111722;
  --panel-2: #151d2b;
  --text: #edf2f7;
  --muted: #94a3b8;
  --line: #243044;
  --primary: #ef4444;
  --primary-2: #b91c1c;
  --good: #22c55e;
  --bad: #ef4444;
  --warn: #f59e0b;
  --shadow: 0 20px 60px rgba(0, 0, 0, .35);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(239, 68, 68, .14), transparent 30%),
    radial-gradient(circle at 90% 10%, rgba(59, 130, 246, .10), transparent 24%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: #fca5a5; text-decoration: none; }
a:hover { color: #fecaca; }
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(10,13,18,.86);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong { display: block; font-size: 18px; letter-spacing: .3px; }
.brand span { display: block; font-size: 12px; color: var(--muted); }
.logo {
  width: 42px; height: 42px; border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #7f1d1d);
  color: white; font-weight: 900; box-shadow: var(--shadow);
}
nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
nav a, .nav-form button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
}
nav a:hover, .nav-form button:hover, nav a.active {
  color: var(--text);
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.08);
}
.nav-form { margin: 0; }

.container { width: min(1180px, calc(100% - 32px)); margin: 36px auto; }
.footer { width: min(1180px, calc(100% - 32px)); margin: 40px auto; color: var(--muted); font-size: 13px; }

.hero {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 28px;
  align-items: center;
  min-height: 430px;
  padding: 36px;
  border: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(135deg, rgba(17,23,34,.95), rgba(21,29,43,.82));
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.hero h1, .page-head h1, .auth-card h1, .profile-info h1 { margin: 0 0 14px; font-size: clamp(34px, 6vw, 60px); line-height: 1; }
.page-head h1, .profile-info h1 { font-size: clamp(28px, 4vw, 44px); }
.lead { color: var(--muted); font-size: 19px; max-width: 640px; }
.eyebrow { margin: 0 0 10px; color: #fca5a5; text-transform: uppercase; letter-spacing: .18em; font-size: 12px; font-weight: 800; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

.code-card, .panel, .auth-card, .stat, .profile-head {
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(17,23,34,.92);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.code-card { padding: 22px; overflow: auto; }
.code-card span { color: #fca5a5; font-weight: 700; }
.feature-list { margin: 16px 0 0; padding-left: 20px; }
.feature-list li { margin: 8px 0; color: #d5dfeb; }
pre { white-space: pre-wrap; word-break: break-word; }
.code-block, .inline-pre { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #080b10; color: #e5e7eb; }
.inline-pre { margin: 0; padding: 8px 10px; font-size: 12px; }

.grid { display: grid; gap: 22px; margin-top: 24px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel { padding: 22px; }
.panel h2, .panel h3 { margin-top: 0; }
.panel p { color: var(--muted); }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}
.compact-head { margin-top: 28px; }
.head-actions, .inline-actions, .actions, .product-top, .product-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.public-stats { margin-top: 24px; }
.stat { padding: 20px; }
.stat span { display: block; color: var(--muted); font-size: 13px; }
.stat strong { display: block; font-size: 34px; margin-top: 6px; }

.auth-card { width: min(560px, 100%); margin: 0 auto; padding: 28px; }
.auth-card.wide { width: min(720px, 100%); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { color: var(--muted); font-size: 12px; font-weight: 400; }
.breakable { overflow-wrap: anywhere; }
.divider { height: 1px; background: rgba(255,255,255,.08); margin: 18px 0; }

.form, .form label { display: grid; gap: 12px; }
.form.compact { gap: 10px; }
label { color: #dbe4ef; font-weight: 650; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #0b1018;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 13px;
  outline: none;
  font: inherit;
}
input:focus, textarea:focus, select:focus { border-color: #f87171; box-shadow: 0 0 0 4px rgba(248, 113, 113, .12); }
input[readonly] { cursor: copy; color: #fecaca; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  color: var(--text);
  padding: 11px 16px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  min-height: 42px;
}
.button:hover { color: white; background: rgba(255,255,255,.10); }
.button.primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); border-color: transparent; }
.button.primary:hover { filter: brightness(1.08); }
.button.danger { color: #fecaca; border-color: rgba(239,68,68,.4); }
.button.tiny { padding: 7px 10px; min-height: 32px; font-size: 13px; }
.button.full { width: 100%; }
.button.steam, .button.steam-nav { background: linear-gradient(135deg, #1b2838, #171a21); border-color: rgba(255,255,255,.12); }

.notice {
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 18px;
  border: 1px solid rgba(255,255,255,.10);
}
.notice.good { background: rgba(34,197,94,.12); color: #bbf7d0; }
.notice.bad { background: rgba(239,68,68,.12); color: #fecaca; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid rgba(255,255,255,.12);
}
.badge.good { color: #bbf7d0; background: rgba(34,197,94,.12); }
.badge.bad { color: #fecaca; background: rgba(239,68,68,.12); }
.badge.warn { color: #fde68a; background: rgba(245,158,11,.12); }

.table-panel { overflow: hidden; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 13px 12px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.07); vertical-align: top; }
th { color: #cbd5e1; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
td { color: #e2e8f0; }
.empty { color: var(--muted); text-align: center; padding: 28px; }
.actions form { margin: 0; }

.details { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}
.product-card { padding: 0; overflow: hidden; }
.product-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: #0b1018;
}
.product-image.placeholder {
  display: grid;
  place-items: center;
  color: #fca5a5;
  font-size: 28px;
  font-weight: 900;
  background: linear-gradient(135deg, rgba(239,68,68,.18), rgba(59,130,246,.18));
}
.product-body { padding: 18px 20px 20px; }
.product-top { justify-content: space-between; align-items: flex-start; }
.product-top h3 { margin: 0; font-size: 22px; }
.price-pill {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(239,68,68,.14);
  color: #fecaca;
  font-weight: 800;
}
.buy-form { margin: 0; }

.user-pill, .link-user {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
}
.user-pill strong { display: block; }
.user-pill span { display: block; color: var(--muted); font-size: 12px; }
.link-user { color: var(--text); }
.avatar, .profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  object-fit: cover;
  background: #0b1018;
}
.avatar.small { width: 34px; height: 34px; }
.avatar.placeholder, .profile-avatar.placeholder {
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #fca5a5;
}
.profile-avatar { width: 74px; height: 74px; }
.profile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
}
.profile-info { display: flex; align-items: center; gap: 18px; }
.balance-box {
  min-width: 220px;
  padding: 18px 20px;
  border-radius: 18px;
  background: rgba(239,68,68,.10);
  text-align: right;
}
.balance-box span { display: block; color: var(--muted); }
.balance-box strong { display: block; font-size: 34px; margin-top: 6px; }
.inline-balance-form {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 8px;
  align-items: center;
}

@media (max-width: 1100px) {
  .topbar { grid-template-columns: 1fr; }
  nav { justify-content: flex-start; }
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .topbar, .page-head, .profile-head { align-items: flex-start; }
  .hero, .grid.two, .grid.three, .stats, .cards-grid { grid-template-columns: 1fr; }
  .hero { padding: 24px; min-height: auto; }
  .container { margin-top: 24px; }
  .profile-head { flex-direction: column; }
  .inline-balance-form { grid-template-columns: 1fr; }
}

.admin-badge {
  margin-left: 6px;
  vertical-align: middle;
}

/* ArkadaMOD v4: редактор главной страницы */
.hero.hero-single { grid-template-columns: 1fr; }
.content-block { margin-top: 24px; }
.content-block h2 { margin-top: 0; }
.content-text p { margin: 0 0 12px; color: var(--muted); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.no-margin { margin-top: 12px; }
.content-editor { gap: 20px; }
.content-editor .panel { display: grid; gap: 14px; }
.form .check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #dbe4ef;
  font-weight: 750;
}
.form .check-row input[type="checkbox"] {
  width: auto;
  min-width: 18px;
  height: 18px;
  accent-color: var(--primary);
}
.sticky-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  position: sticky;
  bottom: 12px;
  z-index: 5;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  background: rgba(10,13,18,.92);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}
.reset-form { margin-top: 18px; }

@media (max-width: 900px) {
  .grid.four { grid-template-columns: 1fr; }
}

.button.disabled,
.button[aria-disabled="true"] {
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.notice.warn {
  background: rgba(245,158,11,.12);
  color: #fde68a;
}

@media (max-width: 760px) {
  .form-row { grid-template-columns: 1fr; }
}
