:root {
  --bg: #0f1218;
  --surface: #171b24;
  --surface-2: #1f2431;
  --border: #2a3040;
  --text: #e7e9ee;
  --muted: #9097a7;
  --accent: #6c8cff;
  --accent-2: #a46cff;
  --ok: #3ecf8e;
  --warn: #f5a524;
  --err: #ff5d6c;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h2 { font-size: 1.35rem; }
img { max-width: 100%; display: block; }

.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.page { flex: 1; padding-top: 28px; padding-bottom: 48px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.inline { display: inline; margin: 0; }
.push-right { margin-left: auto; }

/* Header */
.site-header { background: rgba(15, 18, 24, .9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.header-row { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.logo { font-weight: 800; font-size: 1.25rem; color: var(--text); letter-spacing: .3px; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo-mark { background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.main-nav { display: flex; gap: 4px; flex: 1; }
.main-nav a { color: var(--muted); padding: 8px 12px; border-radius: 8px; white-space: nowrap; }
.main-nav a:hover, .main-nav a.active { color: var(--text); background: var(--surface-2); text-decoration: none; }
.header-tools { display: flex; align-items: center; gap: 10px; }
.user-link { color: var(--text); font-weight: 600; }

.lang-switch { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin: 0; }
.lang-switch button { background: none; border: 0; color: var(--muted); padding: 6px 9px; cursor: pointer; font: inherit; font-size: .8rem; font-weight: 600; }
.lang-switch button:hover { color: var(--text); }
.lang-switch button.current { background: var(--accent); color: #fff; }

.nav-toggle, .nav-burger { display: none; }

/* Buttons */
.btn { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: 0; border-radius: 10px; padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 12px; font-size: .875rem; }
.btn-lg { padding: 13px 24px; font-size: 1.05rem; }
.btn-block { width: 100%; justify-content: center; }
.btn.disabled { opacity: .5; cursor: default; background: var(--surface-2); }
.link-btn { background: none; border: 0; color: var(--err); cursor: pointer; font: inherit; font-size: .85rem; padding: 0; }

/* Hero */
.hero { display: grid; grid-template-columns: 1.6fr 1fr; gap: 32px; align-items: center; padding: 40px; margin-bottom: 40px; border-radius: 20px; background: radial-gradient(ellipse at top left, rgba(108, 140, 255, .25), transparent 60%), radial-gradient(ellipse at bottom right, rgba(164, 108, 255, .2), transparent 60%), var(--surface); border: 1px solid var(--border); }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
.lead { font-size: 1.1rem; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.stats { display: grid; gap: 12px; }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; display: flex; align-items: baseline; gap: 10px; }
.stat strong { font-size: 2rem; }
.stat span { color: var(--muted); }

section { margin-bottom: 40px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head h1, .section-head h2 { margin: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }

/* Cards & grid */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.product-card { padding: 0; overflow: hidden; color: var(--text); transition: transform .15s, box-shadow .15s; display: flex; flex-direction: column; }
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none; border-color: var(--accent); }
.product-card .card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.product-card h3 { margin-bottom: 4px; }
.product-card p { margin: 0 0 12px; font-size: .925rem; flex: 1; }
.meta { display: flex; gap: 12px; font-size: .8rem; color: var(--muted); }

.cover { position: relative; aspect-ratio: 16 / 9; display: grid; place-items: center; overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-game { background: linear-gradient(135deg, #3b2a7a, #6c8cff); }
.cover-software { background: linear-gradient(135deg, #0f5c4d, #3ecf8e); }
.cover-letter { font-size: 3.5rem; font-weight: 800; color: rgba(255, 255, 255, .85); }
.cover-lg { border-radius: var(--radius); }
.cover-lg .cover-letter { font-size: 6rem; }
.badge { position: absolute; top: 10px; left: 10px; font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: rgba(0, 0, 0, .45); color: #fff; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--border); }

/* Catalog */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 16px; border-radius: 99px; border: 1px solid var(--border); color: var(--muted); }
.tabs a.active, .tabs a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.filters { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }
.filters input { flex: 1; min-width: 200px; }

.product { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-bottom: 32px; }
.specs { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 16px 0; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; }
.crumbs { color: var(--muted); margin-bottom: 12px; font-size: .9rem; }
.prose p:first-child { margin-top: 0; }

/* Forms */
input, select, textarea { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font: inherit; }
.filters input, .filters select { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.form .field { margin-bottom: 16px; }
.form label { display: block; font-weight: 600; margin-bottom: 6px; }
.form .help { display: block; color: var(--muted); margin-top: 6px; font-size: .8rem; }
.form .help ul { margin: 4px 0; padding-left: 18px; }
.form .error, .form-errors { display: block; color: var(--err); margin-top: 6px; font-size: .875rem; }
.has-error input, .has-error textarea, .has-error select { border-color: var(--err); }
.auth-box { max-width: 440px; margin: 0 auto; }
.contact .info ul { padding-left: 18px; }

/* Messages */
.messages { list-style: none; padding: 0; margin: 0 0 20px; }
.msg { padding: 12px 16px; border-radius: 10px; margin-bottom: 8px; border: 1px solid var(--border); background: var(--surface-2); }
.msg-success { border-color: var(--ok); }
.msg-info { border-color: var(--accent); }
.msg-warning { border-color: var(--warn); }
.msg-error { border-color: var(--err); }

/* Forum */
.table { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; }
.table > p { padding: 16px; margin: 0; }
.forum-table .row { display: grid; grid-template-columns: 1fr 110px 110px 150px; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border); align-items: center; background: var(--surface); }
.forum-table .row.head { border-top: 0; background: var(--surface-2); color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; }
.row-title { font-weight: 600; color: var(--text); display: block; }
.forum-table small { display: block; }
.tag { display: inline-block; font-size: .72rem; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); margin-right: 6px; vertical-align: middle; }
.posts { display: grid; gap: 14px; margin-bottom: 20px; }
.post header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.pagination { display: flex; gap: 16px; align-items: center; justify-content: center; margin: 20px 0; color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 24px 0; color: var(--muted); font-size: .9rem; }
.footer-row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-row nav { display: flex; gap: 16px; }

/* Responsive */
@media (max-width: 1279px) {
  .header-row { flex-wrap: wrap; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
  .nav-burger { display: block; margin-left: auto; width: 36px; height: 36px; cursor: pointer; position: relative; order: 2; }
  .nav-burger span, .nav-burger span::before, .nav-burger span::after { position: absolute; left: 7px; right: 7px; height: 2px; background: var(--text); content: ""; }
  .nav-burger span { top: 17px; }
  .nav-burger span::before { top: -7px; left: 0; right: 0; }
  .nav-burger span::after { top: 7px; left: 0; right: 0; }
  .main-nav, .header-tools { display: none; flex-basis: 100%; order: 3; }
  .main-nav { flex-direction: column; }
  .header-tools { flex-wrap: wrap; padding-bottom: 6px; }
  .nav-toggle:checked ~ .main-nav, .nav-toggle:checked ~ .header-tools { display: flex; }
}
@media (max-width: 960px) {
  .hero, .two-col, .product { grid-template-columns: 1fr; }
  .hero { padding: 24px; }
}
@media (max-width: 640px) {
  .forum-table .row { grid-template-columns: 1fr 70px; }
  .forum-table .row > span:nth-child(n+3) { display: none; }
  .filters input, .filters select { width: 100%; }
}

/* Payments */
.price-tag { position: absolute; top: 10px; right: 10px; font-size: .8rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: rgba(0, 0, 0, .55); color: #fff; }
.price-tag.free, .price-line .free { color: var(--ok); }
.price-line { font-size: 1.4rem; margin: 8px 0 0; display: flex; align-items: center; gap: 10px; }
.status-paid { color: var(--ok); }
.status-pending { color: var(--warn); }
.status-failed, .status-cancelled, .status-refunded { color: var(--muted); }

/* Dashboard */
.dash { display: grid; grid-template-columns: 220px 1fr; gap: 28px; align-items: start; }
.dash-nav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.dash-nav h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 4px 8px 10px; }
.dash-nav a { color: var(--muted); padding: 8px 10px; border-radius: 8px; }
.dash-nav a:hover, .dash-nav a.active { color: var(--text); background: var(--surface-2); text-decoration: none; }
.dash-main { min-width: 0; }
.dash-main section { margin-bottom: 24px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
.kpis .stat { flex-direction: column; gap: 2px; }
.dash-table .row { display: grid; grid-template-columns: 1fr 110px 80px 70px 170px 120px; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); align-items: center; background: var(--surface); }
.dash-table.cols-4 .row { grid-template-columns: 1fr 90px 90px 120px; }
.dash-table.cols-5 .row { grid-template-columns: 1fr 120px 100px 120px 220px; }
.dash-table .row.head { border-top: 0; background: var(--surface-2); color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; }
.dash-table small { display: block; }
.row-actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; font-size: .9rem; }
.link-btn.neutral { color: var(--accent); }
a.danger { color: var(--err); }
.btn-danger { background: var(--err); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid .field:has(textarea), .form-grid .form-errors, .form-grid .form-actions { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; align-items: center; }
.form input[type="checkbox"] { width: auto; transform: scale(1.3); margin-left: 4px; }
.form input[type="file"] { padding: 8px; }
@media (max-width: 960px) {
  .dash { grid-template-columns: 1fr; }
  .dash-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .dash-nav h3 { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1180px) {
  .dash-table .row, .dash-table.cols-4 .row, .dash-table.cols-5 .row { grid-template-columns: 1fr auto; }
  .dash-table .row > span:not(:first-child):not(:last-child) { display: none; }
}

/* --- Роли и личный кабинет --- */
.role-badge { display: inline-block; font-size: .7rem; font-weight: 700; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); vertical-align: middle; }
.role-red { color: #ff8f8f; border-color: rgba(255, 110, 110, .45); }
.role-blue { color: #8fb0ff; border-color: rgba(108, 140, 255, .5); }
.role-purple { color: #c49bff; border-color: rgba(164, 108, 255, .5); }
.role-gray { color: var(--muted); }
.role-orange { color: var(--warn); border-color: rgba(245, 165, 36, .45); }
.role-green { color: var(--ok); border-color: rgba(62, 207, 142, .45); }
.tag-warn { color: var(--warn); border-color: rgba(245, 165, 36, .45); }
.cabinet-head h1 { margin-bottom: 4px; }
.cabinet-head p { margin: 0; }
.tabs-sm a { padding: 5px 12px; font-size: .85rem; }
.library { display: grid; gap: 12px; margin-bottom: 28px; }
.library-item { display: grid; grid-template-columns: 160px 1fr auto; gap: 18px; align-items: center; padding: 12px; }
.library-item .cover-sm { border-radius: 10px; }
.library-item .cover-sm .cover-letter { font-size: 2.4rem; }
.library-info h3 { margin: 0 0 4px; font-size: 1.05rem; }
.library-info h3 a { color: var(--text); }
.library-info p { margin: 2px 0; }
.orders-table .row { display: grid; grid-template-columns: 1fr 120px 110px 80px 160px 130px; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); align-items: center; background: var(--surface); }
.orders-table .row.head { border-top: 0; background: var(--surface-2); color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; }
.orders-table small { display: block; }
.orders-table .row > span:last-child { text-align: right; }
@media (max-width: 1180px) {
  .orders-table .row { grid-template-columns: 1fr 110px 110px 130px; }
  .orders-table .row > span:nth-child(4), .orders-table .row > span:nth-child(5) { display: none; }
  .orders-table .row > span:nth-child(2), .orders-table .row > span:nth-child(3) { display: block; }
}
@media (max-width: 640px) {
  .library-item { grid-template-columns: 96px 1fr; }
  .library-actions { grid-column: 1 / -1; }
  .library-actions .btn { width: 100%; justify-content: center; }
  .orders-table .row { grid-template-columns: 1fr auto; }
  .orders-table .row > span:nth-child(2) { display: none; }
  .orders-table .row > span:nth-child(3) { display: block; text-align: right; }
  .orders-table .row > span:last-child { grid-column: 1 / -1; text-align: left; }
  .orders-table .row.head > span:last-child { display: none; }
}
.role-form { display: flex; gap: 6px; align-items: center; }
.role-form select { padding: 5px 8px; width: auto; }
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.role-card { color: var(--text); display: block; }
.role-card:hover { border-color: var(--accent); text-decoration: none; }
.role-card h3 { margin: 0; }
.role-card .role-badge { font-size: .9rem; padding: 3px 12px; }
.perm-list { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 4px; font-size: .9rem; color: var(--muted); }
.perm-list li::before { content: "✕"; display: inline-block; width: 1.4em; color: var(--muted); }
.perm-list li.on { color: var(--text); }
.perm-list li.on::before { content: "✓"; color: var(--ok); }
.form section.card { margin-bottom: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.perm-row { display: flex; gap: 14px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); cursor: pointer; }
.perm-row:first-of-type { border-top: 0; }
.perm-row input { margin-top: 5px; }
.perm-row small { display: block; }
.perm-row.disabled { opacity: .7; cursor: default; }
.access-table .row { display: grid; grid-template-columns: 1fr 220px; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); align-items: center; background: var(--surface); }
.access-table .row.head { border-top: 0; background: var(--surface-2); color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; }
.access-table label small { display: block; }
@media (max-width: 640px) { .access-table .row { grid-template-columns: 1fr; } }

/* ==========================================================================
   Оформление: космический фон, стеклянные панели, неоновые акценты
   ========================================================================== */
:root {
  --bg: #070814;
  --surface: rgba(18, 21, 40, .72);
  --surface-2: rgba(36, 41, 72, .62);
  --border: rgba(150, 165, 255, .16);
  --border-strong: rgba(150, 165, 255, .32);
  --accent: #38d9f0;
  --accent-rgb: 56, 217, 240;
  --accent-2: #3b82f6;
  --accent-2-rgb: 59, 130, 246;
  --accent-3: #14b8a6;
  --btn-1: #0aa2c0;
  --btn-2: #2563eb;
  --btn-3: #0d9488;
  --h1-1: #ffffff;
  --h1-2: #c4f4ff;
  --h1-3: #7fe3f2;
  --glow: 0 0 0 1px rgba(var(--accent-rgb), .45), 0 10px 40px rgba(var(--accent-rgb), .25);
  --radius: 14px;
  --shadow: 0 12px 40px rgba(0, 0, 0, .45);
  --eyebrow: #b6f0fa;
  --version: #bfeaf5;
  color-scheme: dark;
}
html { background: var(--bg); }
body { background: transparent; position: relative; isolation: isolate; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2;
  background: url("../img/bg-space.a43ce945cdff.svg") center bottom / cover no-repeat, var(--bg);
  filter: hue-rotate(-55deg) saturate(.9);
}
/* Затемнение по центру, чтобы текст хорошо читался поверх фона */
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(7, 8, 20, .1), rgba(7, 8, 20, .5) 24%, rgba(7, 8, 20, .5) 76%, rgba(7, 8, 20, .1)),
    linear-gradient(180deg, rgba(7, 8, 20, .2), rgba(7, 8, 20, .45) 60%, rgba(7, 8, 20, .2));
}

h1 {
  background: linear-gradient(100deg, var(--h1-1) 10%, var(--h1-2) 55%, var(--h1-3) 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: -.01em;
}
.section-head h2, section > h2 { position: relative; padding-left: 14px; }
.section-head h2::before, section > h2::before {
  content: ""; position: absolute; left: 0; top: .12em; bottom: .12em; width: 4px; border-radius: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(var(--accent-rgb), .7);
}

/* Шапка */
.site-header {
  background: rgba(8, 10, 24, .62); backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), .5), rgba(var(--accent-2-rgb), .5), transparent) 1;
}
.logo-mark { filter: drop-shadow(0 0 8px rgba(var(--accent-rgb), .8)); }
.main-nav a { position: relative; transition: color .15s, background .15s; }
.main-nav a.active { background: rgba(var(--accent-rgb), .12); }
.main-nav a.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); box-shadow: 0 0 8px var(--accent);
}
.lang-switch { background: rgba(0, 0, 0, .25); }
.lang-switch button.current { background: linear-gradient(135deg, var(--btn-1), var(--btn-2)); }

/* Стеклянные панели */
.card, .table, .stat, .dash-nav, .msg, .hero {
  backdrop-filter: blur(10px) saturate(130%);
  -webkit-backdrop-filter: blur(10px) saturate(130%);
}
.card, .table, .dash-nav { box-shadow: var(--shadow); }
.table .row:not(.head) { transition: background .15s; }
.table .row:not(.head):hover { background: rgba(48, 56, 100, .55); }

/* Кнопки */
.btn {
  background: linear-gradient(135deg, var(--btn-1), var(--btn-2) 60%, var(--btn-3));
  background-size: 160% 160%; background-position: 0 50%;
  box-shadow: 0 6px 20px rgba(var(--accent-rgb), .32), inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: transform .15s, box-shadow .15s, background-position .4s;
}
.btn:hover { filter: none; transform: translateY(-1px); background-position: 100% 50%; box-shadow: 0 8px 28px rgba(var(--accent-2-rgb), .45), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn-ghost { background: rgba(255, 255, 255, .03); box-shadow: none; border-color: var(--border-strong); }
.btn-ghost:hover { background: rgba(var(--accent-rgb), .12); box-shadow: 0 0 0 1px rgba(var(--accent-rgb), .4); }
.btn-danger { background: linear-gradient(135deg, #ff5d6c, #ff3d8b); box-shadow: 0 6px 20px rgba(255, 93, 108, .3); }
.btn.disabled { box-shadow: none; transform: none; }

/* Главный экран */
.hero {
  position: relative; overflow: hidden; isolation: isolate; padding: 56px 48px;
  background: linear-gradient(135deg, rgba(30, 34, 74, .75), rgba(16, 18, 40, .6));
  border: 1px solid var(--border-strong); box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; filter: blur(60px); z-index: -1; }
.hero::before { width: 380px; height: 380px; left: -120px; top: -160px; background: rgba(var(--accent-rgb), .45); }
.hero::after { width: 340px; height: 340px; right: -100px; bottom: -180px; background: rgba(var(--accent-2-rgb), .35); }
.hero h1 { font-size: clamp(2rem, 4.4vw, 3.2rem); line-height: 1.08; }
.hero .lead { color: #b9c0d6; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px; padding: 4px 12px; border-radius: 99px;
  font-size: .78rem; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
  color: var(--eyebrow); background: rgba(var(--accent-rgb), .12); border: 1px solid rgba(var(--accent-rgb), .4);
}
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-3); box-shadow: 0 0 10px var(--accent-3); }
.stat { background: rgba(10, 12, 28, .45); }
.hero .stat strong, .kpis .stat strong {
  background: linear-gradient(120deg, var(--h1-1), var(--h1-2) 60%, var(--h1-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Карточки продуктов */
.product-card { transition: transform .2s, box-shadow .2s, border-color .2s; }
.product-card:hover { transform: translateY(-5px); box-shadow: var(--glow); border-color: rgba(var(--accent-rgb), .6); }
.product-card .cover img { transition: transform .4s; }
.product-card:hover .cover img { transform: scale(1.06); }
.cover-game {
  background:
    radial-gradient(circle at 25% 20%, rgba(255, 255, 255, .25) 0 1px, transparent 2px) 0 0 / 22px 22px,
    radial-gradient(ellipse at 80% 110%, rgba(255, 111, 184, .55), transparent 60%),
    linear-gradient(135deg, #24135e, #4b3bd1 55%, #7b93ff);
}
.cover-software {
  background:
    linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px) 0 0 / 100% 18px,
    linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px) 0 0 / 18px 100%,
    radial-gradient(ellipse at 20% 110%, rgba(24, 213, 193, .5), transparent 60%),
    linear-gradient(135deg, #072e3a, #0e6b63 55%, #3ecf8e);
}
.cover-letter { text-shadow: 0 0 30px rgba(255, 255, 255, .45); }
.badge, .price-tag { backdrop-filter: blur(6px); border: 1px solid rgba(255, 255, 255, .15); }

/* Поля ввода */
input, select, textarea { background: rgba(5, 6, 16, .6); border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .25); }
select option { background: #10132a; }

.tabs a { background: rgba(255, 255, 255, .02); transition: all .15s; }
.tabs a.active { background: linear-gradient(135deg, rgba(var(--accent-rgb), .25), rgba(var(--accent-2-rgb), .25)); border-color: rgba(var(--accent-rgb), .55); color: var(--text); }

.site-footer { background: rgba(6, 7, 18, .7); backdrop-filter: blur(10px); border-top-color: var(--border); }

@media (max-width: 960px) {
  .hero { padding: 32px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .btn, .product-card, .product-card .cover img { transition: none; }
  .btn:hover, .product-card:hover { transform: none; }
}

/* ==========================================================================
   Аватары
   ========================================================================== */
.avatar {
  --size: 40px;
  width: var(--size); height: var(--size); flex: 0 0 var(--size); border-radius: 50%;
  display: inline-grid; place-items: center; overflow: hidden; vertical-align: middle;
  font-weight: 800; font-size: calc(var(--size) * .42); color: #fff; text-transform: uppercase; line-height: 1;
  background: linear-gradient(135deg, hsl(var(--hue, 230) 80% 62%), hsl(calc(var(--hue, 230) + 50) 75% 48%));
  box-shadow: 0 0 0 2px rgba(7, 8, 20, .9), 0 0 0 3px rgba(150, 165, 255, .45);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-team { box-shadow: 0 0 0 2px rgba(7, 8, 20, .9), 0 0 0 3px var(--accent-2), 0 0 14px rgba(var(--accent-2-rgb), .6); }
.user-link { display: inline-flex; align-items: center; gap: 8px; }
.user-link:hover { text-decoration: none; }

.post { display: grid; grid-template-columns: 132px 1fr; gap: 0; padding: 0; overflow: hidden; }
.post-author {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 18px 10px; background: rgba(10, 12, 28, .45); border-right: 1px solid var(--border); font-size: .85rem;
}
.post-author strong { word-break: break-word; }
.post-body { padding: 16px 20px; min-width: 0; }
.post-body header { margin-bottom: 8px; }
.author-cell { display: inline-flex; align-items: center; gap: 8px; }
@media (max-width: 640px) {
  .post { grid-template-columns: 1fr; }
  .post-author { flex-direction: row; justify-content: flex-start; text-align: left; border-right: 0; border-bottom: 1px solid var(--border); padding: 10px 14px; }
}

.avatar-editor { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.avatar-editor .avatar { --size: 96px; }
.avatar-editor form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0; }
.avatar-editor input[type="file"] { width: auto; max-width: 100%; padding: 7px; }
.cabinet-head { justify-content: flex-start; }
.cabinet-head .avatar { --size: 64px; }
@media (max-width: 640px) { .post-author .avatar { --size: 40px !important; } }

/* Информационные страницы, подвал, страницы ошибок */
.legal { max-width: 860px; margin: 0 auto; padding: 32px 40px; }
.legal h2 { margin-top: 1.6em; font-size: 1.2rem; }
.legal ul { padding-left: 20px; }
.legal li { margin: 4px 0; }
.footer-row > div { display: flex; flex-direction: column; gap: 4px; }
.footer-row nav { flex-wrap: wrap; }
.buy-note { margin-top: 12px; max-width: 520px; }
.error-page { grid-template-columns: 1fr; text-align: center; padding: 72px 24px; }
.error-page .hero-actions { justify-content: center; }
.error-page .eyebrow { font-size: 1rem; }
.form .field label a { font-weight: 600; }
@media (max-width: 640px) { .legal { padding: 22px 18px; } }

/* Версия и стадия выпуска */
.version-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; }
.version { font-size: .82rem; font-weight: 700; color: var(--version); font-variant-numeric: tabular-nums; }
.version-line-lg .version { font-size: .95rem; }
.stage {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px;
  font-size: .72rem; font-weight: 700; letter-spacing: .2px; border: 1px solid; white-space: nowrap;
}
.stage-release { color: var(--ok); border-color: rgba(62, 207, 142, .45); background: rgba(62, 207, 142, .1); }
.stage-beta { color: var(--warn); border-color: rgba(245, 165, 36, .5); background: rgba(245, 165, 36, .1); }
.stage-alpha { color: #ff8fb8; border-color: rgba(255, 111, 184, .5); background: rgba(255, 111, 184, .1); }
.product-card .meta .more { margin-left: auto; color: var(--accent); font-weight: 600; }
.product-card:hover .meta .more { color: var(--text); }
.stage-note { padding: 10px 14px; border-radius: 10px; font-size: .9rem; border: 1px solid; }
.stage-note-beta { color: #ffd593; border-color: rgba(245, 165, 36, .45); background: rgba(245, 165, 36, .08); }
.stage-note-alpha { color: #ffc2da; border-color: rgba(255, 111, 184, .45); background: rgba(255, 111, 184, .08); }
.product-tabs { position: sticky; top: 72px; z-index: 5; }
.product-section { margin-bottom: 18px; scroll-margin-top: 130px; }
.product-section h2 .stage { vertical-align: middle; margin-left: 6px; }
.product-section ul { padding-left: 20px; }

/* ==========================================================================
   Логотип, переключатель темы
   ========================================================================== */
.logo { display: inline-flex; align-items: center; flex-shrink: 0; }
.logo-img { height: 38px; width: auto; max-width: none; }
[data-theme="dark"] .logo-for-light, [data-theme="light"] .logo-for-dark { display: none !important; }
.theme-toggle {
  width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border-strong); background: rgba(var(--accent-rgb), .06); color: var(--text); font-size: 1.05rem; padding: 0;
  transition: background .15s, box-shadow .15s;
}
.theme-toggle:hover { background: rgba(var(--accent-rgb), .16); box-shadow: 0 0 0 1px rgba(var(--accent-rgb), .4); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[data-theme="dark"] .theme-toggle .icon-moon, [data-theme="light"] .theme-toggle .icon-sun { display: none; }
.hero-side { display: grid; gap: 16px; justify-items: center; }
.hero-emblem img { width: 180px; height: auto; filter: drop-shadow(0 12px 30px rgba(var(--accent-rgb), .35)); }
.hero-side .stats { width: 100%; }
@media (max-width: 960px) { .hero-emblem { display: none; } }
@media (max-width: 640px) { .logo-img { height: 36px; } }

/* ==========================================================================
   Форум: главная тема → подтема → публикация
   ========================================================================== */
.forum-intro { margin-top: -6px; margin-bottom: 24px; }
.forum-group { margin-bottom: 28px; }
.forum-group-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 10px; }
.forum-group-head h2 { margin: 0; }
.forum-group-head h2 a { color: var(--text); }
.forum-group-head p { margin: 4px 0 0; }
.subforum-cell { display: flex; gap: 12px; align-items: center; min-width: 0; }
.subforum-icon {
  flex: 0 0 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 800;
  color: var(--accent); background: rgba(var(--accent-rgb), .1); border: 1px solid rgba(var(--accent-rgb), .3);
}
.last-cell { min-width: 0; }
.last-link { display: block; color: var(--text); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.forum-table .row { grid-template-columns: 1fr 110px 110px 190px; }
.topic-badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 3px; }
.topic-badges .tag { margin: 0; }
.kind {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 99px; border: 1px solid;
  font-size: .72rem; font-weight: 700; white-space: nowrap; vertical-align: middle;
}
.kind-discussion { color: var(--accent); border-color: rgba(var(--accent-rgb), .4); background: rgba(var(--accent-rgb), .08); }
.kind-question { color: var(--warn); border-color: rgba(245, 165, 36, .5); background: rgba(245, 165, 36, .1); }
.kind-solved { color: var(--ok); border-color: rgba(62, 207, 142, .5); background: rgba(62, 207, 142, .1); }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.topic-head { margin-bottom: 14px; }
.topic-head h1 { margin: 6px 0 0; }
.posts-divider { font-size: 1rem; color: var(--muted); margin: 10px 0 -2px; padding-left: 0; }
.posts-divider::before { display: none; }
.post-question { border-color: rgba(245, 165, 36, .45); }
.post-solution { border-color: rgba(62, 207, 142, .6); box-shadow: 0 0 0 1px rgba(62, 207, 142, .35), var(--shadow); }
.post-actions { display: inline-flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.solution-hint { margin: -4px 0 0; }
.topic-form [role="radiogroup"], .topic-form #id_kind { display: flex; gap: 10px; flex-wrap: wrap; }
.form input[type="radio"] { width: auto; margin: 0; accent-color: var(--accent); }
.topic-form #id_kind label {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; margin: 0;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border-strong); background: rgba(var(--accent-rgb), .04);
}
.topic-form #id_kind label:has(input:checked) { border-color: var(--accent); background: rgba(var(--accent-rgb), .14); }
.forum-structure { margin-bottom: 18px; }
.forum-structure .row.head { text-transform: none; letter-spacing: 0; font-size: .85rem; }
.forum-structure .row.head .row-title { font-size: 1rem; }
@media (max-width: 640px) {
  .forum-table .row { grid-template-columns: 1fr 70px; }
  .forum-group-head { flex-direction: column; align-items: flex-start; }
  .head-actions { width: 100%; }
}

/* ==========================================================================
   Светлая тема
   ========================================================================== */
[data-theme="light"] {
  color-scheme: light;
  --bg: #eef3f8;
  --surface: rgba(255, 255, 255, .86);
  --surface-2: rgba(228, 236, 245, .92);
  --border: rgba(16, 42, 72, .12);
  --border-strong: rgba(16, 42, 72, .22);
  --text: #0d1b2e;
  --muted: #56667b;
  --accent: #0782a0;
  --accent-rgb: 7, 130, 160;
  --accent-2: #2563eb;
  --accent-2-rgb: 37, 99, 235;
  --accent-3: #0d9488;
  --btn-1: #0891b2;
  --btn-2: #2563eb;
  --btn-3: #0d9488;
  --ok: #0c8f5f;
  --warn: #b26a00;
  --err: #d43546;
  --h1-1: #0b1a2e;
  --h1-2: #12405f;
  --h1-3: #0782a0;
  --eyebrow: #075f75;
  --version: #1d4a6e;
  --shadow: 0 10px 30px rgba(16, 42, 72, .10);
  --glow: 0 0 0 1px rgba(7, 130, 160, .45), 0 12px 34px rgba(7, 130, 160, .18);
}
[data-theme="light"] body::before {
  filter: none;
  background:
    radial-gradient(ellipse at 12% -10%, rgba(34, 211, 238, .22), transparent 50%),
    radial-gradient(ellipse at 95% 105%, rgba(37, 99, 235, .14), transparent 55%),
    linear-gradient(rgba(16, 42, 72, .045) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(90deg, rgba(16, 42, 72, .045) 1px, transparent 1px) 0 0 / 34px 34px,
    var(--bg);
}
[data-theme="light"] body::after { display: none; }
[data-theme="light"] .site-header {
  background: rgba(255, 255, 255, .78);
  border-image: linear-gradient(90deg, transparent, rgba(7, 130, 160, .45), rgba(37, 99, 235, .35), transparent) 1;
}
[data-theme="light"] .site-footer { background: rgba(255, 255, 255, .72); }
[data-theme="light"] .lang-switch { background: rgba(255, 255, 255, .7); }
[data-theme="light"] .hero {
  background: linear-gradient(135deg, rgba(255, 255, 255, .94), rgba(226, 241, 250, .88));
  box-shadow: var(--shadow), inset 0 1px 0 #fff;
}
[data-theme="light"] .hero::before { background: rgba(34, 211, 238, .28); }
[data-theme="light"] .hero::after { background: rgba(37, 99, 235, .16); }
[data-theme="light"] .hero .lead { color: var(--muted); }
[data-theme="light"] .stat { background: rgba(255, 255, 255, .75); }
[data-theme="light"] .btn-ghost { background: rgba(255, 255, 255, .7); color: var(--text); }
[data-theme="light"] .btn.disabled { color: var(--muted); }
[data-theme="light"] input, [data-theme="light"] select, [data-theme="light"] textarea { background: #fff; }
[data-theme="light"] select option { background: #fff; color: var(--text); }
[data-theme="light"] .tabs a { background: rgba(255, 255, 255, .6); }
[data-theme="light"] .table .row:not(.head):hover { background: rgba(7, 130, 160, .06); }
[data-theme="light"] .post-author { background: rgba(228, 236, 245, .7); }
[data-theme="light"] .avatar { box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(7, 130, 160, .4); }
[data-theme="light"] .avatar-team { box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--accent-2), 0 0 12px rgba(37, 99, 235, .35); }
[data-theme="light"] .section-head h2::before, [data-theme="light"] section > h2::before { box-shadow: none; }
[data-theme="light"] .main-nav a.active::after { box-shadow: none; }
[data-theme="light"] .stage-alpha { color: #c0266f; }
[data-theme="light"] .stage-note-beta { color: #7a4a00; }
[data-theme="light"] .stage-note-alpha { color: #a3245f; }
[data-theme="light"] .role-red { color: #c22f2f; }
[data-theme="light"] .role-blue { color: #1d4ed8; }
[data-theme="light"] .role-purple { color: #7c3aed; }
[data-theme="light"] .hero-emblem img { filter: drop-shadow(0 12px 24px rgba(16, 42, 72, .18)); }

/* Шапка: логотип + меню + инструменты должны помещаться в одну строку */
.site-header .container { max-width: 1320px; }
.btn-dash-label { display: none; }
@media (max-width: 1279px) {
  .btn-dash-label { display: inline; }
}
.user-link { min-width: 0; }
.user-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1279px) { .user-name { max-width: none; } }
@media (min-width: 1280px) {
  .header-row { gap: 16px; }
  .main-nav { gap: 2px; }
  .main-nav a { padding: 8px 10px; }
  .header-tools { gap: 8px; }
}

/* Загрузка файлов по частям */
.upload-panel { margin-top: 10px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border-strong); background: rgba(var(--accent-rgb), .05); }
.upload-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 8px; flex-wrap: wrap; }
.upload-name { word-break: break-all; }
.upload-bar { height: 10px; border-radius: 99px; background: rgba(var(--accent-rgb), .12); overflow: hidden; }
.upload-fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--btn-1), var(--btn-2)); transition: width .25s linear; }
.upload-panel[data-status="paused"] .upload-fill, .upload-panel[data-status="retry"] .upload-fill { background: var(--warn); }
.upload-panel[data-status="done"] .upload-fill { background: var(--ok); }
.upload-panel[data-status="done"] .upload-state { color: var(--ok); font-weight: 600; }
.upload-panel[data-status="error"] { border-color: var(--err); }
.upload-panel[data-status="error"] .upload-numbers { color: var(--err); }
.upload-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; flex-wrap: wrap; color: var(--muted); }
.upload-actions { display: inline-flex; gap: 14px; }
@media (prefers-reduced-motion: reduce) { .upload-fill { transition: none; } }

/* Галерея скриншотов */
.gallery { margin-bottom: 18px; }
.gallery-strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 280px); gap: 12px;
  overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; overscroll-behavior-x: contain;
}
.gallery-item { display: block; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); scroll-snap-align: start; background: var(--surface); }
.gallery-item img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; transition: transform .25s; }
.gallery-item:hover img { transform: scale(1.04); }
.gallery-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Фото в сообщениях форума */
.post-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 180px)); gap: 8px; margin-top: 12px; }
.post-images a { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.post-images img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.post-images.single { grid-template-columns: minmax(0, 420px); }
.post-images.single img { aspect-ratio: auto; max-height: 360px; }

/* Управление скриншотами в панели */
.screenshot-manager { margin-top: 18px; }
.shot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.shot { margin: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.shot img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.shot figcaption { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; }
.shot-actions { display: inline-flex; gap: 10px; }

/* Просмотр фото */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: grid; grid-template-columns: 64px 1fr 64px; align-items: center;
  background: rgba(3, 5, 12, .94);
}
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; padding: 48px 0 16px; min-width: 0; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 110px); object-fit: contain; border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.lightbox figcaption { display: flex; gap: 16px; justify-content: center; color: #d6dbe6; font-size: .9rem; margin-top: 12px; }
.lb-counter { color: #8f98ab; }
.lightbox button {
  background: rgba(255, 255, 255, .08); color: #fff; border: 1px solid rgba(255, 255, 255, .15); cursor: pointer;
  width: 48px; height: 48px; border-radius: 50%; font-size: 1.8rem; line-height: 1; justify-self: center;
}
.lightbox button:hover { background: rgba(255, 255, 255, .18); }
.lb-close { position: absolute; top: 12px; right: 12px; font-size: 1.6rem !important; }
.lb-single .lb-prev, .lb-single .lb-next { visibility: hidden; }
html.lb-open { overflow: hidden; }
@media (max-width: 640px) {
  .lightbox { grid-template-columns: 0 1fr 0; }
  .lb-prev, .lb-next { display: none; }
  .gallery-strip { grid-auto-columns: 78%; }
}
.lightbox .lb-prev { grid-column: 1; grid-row: 1; }
.lightbox figure { grid-column: 2; grid-row: 1; width: 100%; }
.lightbox .lb-next { grid-column: 3; grid-row: 1; }
.lightbox figcaption { flex-wrap: wrap; padding: 0 12px; text-align: center; }
@media (max-width: 640px) { .lightbox figure { padding: 56px 8px 16px; } }
.legal h3 { font-size: 1.02rem; margin: 1.2em 0 .4em; color: var(--text); }
