:root {
  --bg-0: #111214;
  --bg-1: #1e1f22;
  --bg-2: #2b2d31;
  --bg-3: #313338;
  --bg-4: #383a40;
  --line: #3f4147;
  --text: #f2f3f5;
  --muted: #b5bac1;
  --faint: #949ba4;
  --red: #e0141e;
  --red-hover: #c40f18;
  --red-soft: rgba(224, 20, 30, .14);
  --green: #23a55a;
  --radius: 4px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-3);
  color: var(--text);
  font: 15px/1.55 Inter, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
a { color: #ff4d55; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
code { background: var(--bg-1); padding: 1px 6px; border-radius: 4px; font-size: .9em; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.text-red { color: var(--red); }
.inline { display: inline; margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border: 0; border-radius: var(--radius);
  font: 600 15px/1.2 inherit; font-family: inherit; color: #fff; cursor: pointer;
  transition: background .17s var(--ease), transform .17s var(--ease), box-shadow .17s var(--ease);
  text-decoration: none !important; white-space: nowrap;
}

.btn--red { background: var(--red); }
.btn--red:hover { background: var(--red-hover); }
.btn--gray { background: var(--bg-4); }
.btn--gray:hover { background: #4e5058; }
.btn--ghost { background: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--bg-4); color: var(--text); }
.btn--sm { padding: 7px 14px; font-size: 14px; }
.btn--lg { padding: 13px 22px; font-size: 16px; }
.btn--block { width: 100%; }
.btn.is-loading { opacity: .7; pointer-events: none; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: rgba(30, 31, 34, .88); backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, .04);
}
.nav__inner { max-width: 1140px; margin: 0 auto; padding: 0 16px; height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; font-size: 18px; text-decoration: none !important; }
.brand img { filter: drop-shadow(0 2px 8px rgba(224, 20, 30, .4)); transition: transform .5s var(--ease); }
.brand:hover img { transform: rotate(180deg); }
.brand--small { font-size: 15px; }
.nav__links { display: flex; align-items: center; gap: 4px; }
.nav__links > a:not(.btn) { color: var(--muted); padding: 8px 12px; border-radius: 4px; font-weight: 500; text-decoration: none; transition: background .15s, color .15s; }
.nav__links > a:not(.btn):hover { background: var(--bg-4); color: var(--text); }
.nav__links > a.is-active { color: var(--text); background: var(--bg-4); }
@media (max-width: 560px) {
  .nav__links > a[href="/download"] { display: none; }
  .brand span { display: none; }
}

/* ---------- Flash ---------- */
.flashes { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 30; display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); }
.flash {
  padding: 12px 16px; border-radius: var(--radius); background: var(--bg-1); border-left: 4px solid var(--faint);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35); animation: drop .35s var(--ease); transition: opacity .3s, transform .3s;
}
.flash.is-leaving { opacity: 0; transform: translateY(-8px); }
@keyframes drop { from { opacity: 0; transform: translateY(-10px); } }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; background: var(--bg-1); padding: 72px 0 88px; }
.hero__glow {
  position: absolute; inset: -40% -10% auto auto; width: 900px; height: 900px;
  background: radial-gradient(circle, rgba(224, 20, 30, .28), transparent 62%); pointer-events: none;
}
.hero__inner { position: relative; display: grid; grid-template-columns: 1fr 1.1fr; gap: 56px; align-items: center; }
.hero h1 { font-size: clamp(36px, 5.4vw, 60px); font-weight: 800; letter-spacing: -.03em; }
.lead { font-size: 18px; color: var(--muted); max-width: 520px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 14px; }
.hero__note { font-size: 13px; }
.pill { display: inline-block; padding: 4px 12px; margin-bottom: 18px; border-radius: 3px; background: var(--red-soft); color: #ff6b72; font-size: 13px; font-weight: 600; }
@media (max-width: 900px) {
  .hero { padding: 48px 0 64px; }
  .hero__inner { grid-template-columns: 1fr; gap: 40px; }
}

/* ---------- Launcher mock ---------- */
.mock {
  border-radius: 4px; overflow: hidden; background: var(--bg-3);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .06);
  transform: perspective(1400px) rotateY(-8deg) rotateX(3deg);
  transition: transform .6s var(--ease);
}
.mock:hover { transform: perspective(1400px) rotateY(0) rotateX(0); }
.mock__titlebar { height: 26px; background: var(--bg-1); display: flex; align-items: center; justify-content: center; position: relative; }
.mock__title { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--muted); }
.mock__controls { position: absolute; right: 8px; display: flex; gap: 6px; }
.mock__controls i { width: 10px; height: 10px; border-radius: 50%; background: var(--bg-4); }
.mock__controls i.close { background: var(--red); }
.mock__body { display: flex; height: 340px; }
.mock__rail { width: 54px; background: var(--bg-1); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 0; }
.mock__logo { width: 36px; height: 36px; }
.mock__sep { width: 22px; height: 2px; border-radius: 1px; background: var(--bg-4); }
.mock__spacer { flex: 1; }
.mock__icon { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-3); color: var(--muted); display: grid; place-items: center; position: relative; }
.mock__icon svg { width: 18px; height: 18px; }
.mock__icon.is-active { background: var(--red); color: #fff; border-radius: 4px; }
.mock__icon.is-active::before { content: ""; position: absolute; left: -9px; width: 4px; height: 26px; border-radius: 0 4px 4px 0; background: #fff; }
.mock__main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.mock__header { height: 38px; border-bottom: 1px solid rgba(0, 0, 0, .3); display: flex; align-items: center; justify-content: space-between; padding: 0 14px; font-size: 13px; }
.mock__search { width: 110px; height: 20px; border-radius: 4px; background: var(--bg-1); }
.mock__grid { padding: 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mock__card { background: var(--bg-2); border-radius: 4px; overflow: hidden; animation: rise .6s var(--ease) both; animation-delay: var(--d); }
.mock__cover { height: 54px; background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 40%, #111)); }
.mock__name { font-size: 11px; font-weight: 600; padding: 6px 8px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mock__row { display: flex; gap: 4px; padding: 0 8px 8px; }
.mock__play { flex: 1; background: var(--red); border-radius: 4px; font-size: 10px; font-weight: 700; text-align: center; padding: 3px 0; }
.mock__dots { background: var(--bg-4); border-radius: 4px; font-size: 8px; padding: 3px 6px; color: var(--muted); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@media (max-width: 520px) {
  .mock__grid { grid-template-columns: repeat(2, 1fr); }
  .mock__card:nth-child(n+5) { display: none; }
}

/* ---------- Sections ---------- */
.section { padding: 80px 0; }
.section--alt { background: var(--bg-2); }
.section__title { font-size: clamp(26px, 3.4vw, 36px); text-align: center; margin-bottom: 40px; }
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.feature {
  background: var(--bg-2); border-radius: 4px; padding: 24px; border: 1px solid transparent;
  transition: transform .25s var(--ease), border-color .25s, background .25s;
}
.feature:hover { border-color: rgba(224, 20, 30, .4); background: #2e3035; }
.feature h3 { font-size: 17px; margin-top: 16px; }
.feature p { color: var(--muted); margin: 0; font-size: 14px; }
.feature__icon { width: 44px; height: 44px; border-radius: 4px; background: var(--red-soft); color: var(--red); display: grid; place-items: center; }
.feature__icon svg { width: 22px; height: 22px; }
@media (max-width: 960px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .features { grid-template-columns: 1fr; } }

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.steps li { display: flex; gap: 16px; background: var(--bg-3); border-radius: 4px; padding: 22px; }
.steps h3 { font-size: 17px; margin-bottom: 4px; }
.steps p { margin: 0; color: var(--muted); font-size: 14px; }
.steps__n { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--red); display: grid; place-items: center; font-weight: 800; }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; } }

.cta { padding: 80px 0; background: radial-gradient(ellipse at center, rgba(224, 20, 30, .18), transparent 65%), var(--bg-1); }
.cta__inner { text-align: center; display: flex; flex-direction: column; align-items: center; }
.cta__inner h2 { font-size: clamp(28px, 4vw, 40px); margin-top: 16px; }
.cta__inner img { animation: spin 18s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Auth ---------- */
.auth {
  min-height: calc(100vh - 64px - 120px); display: grid; place-items: center; padding: 48px 16px;
  background: radial-gradient(circle at 20% 10%, rgba(224, 20, 30, .22), transparent 45%), radial-gradient(circle at 85% 90%, rgba(224, 20, 30, .12), transparent 40%), var(--bg-1);
}
.auth__card {
  width: 100%; max-width: 460px; background: var(--bg-3); border-radius: 4px; padding: 32px;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .6); text-align: center; animation: pop .4s var(--ease);
}
.auth__card h1 { font-size: 24px; margin: 12px 0 4px; }
.auth__logo { display: block; margin: 0 auto; }
.auth__switch { margin: 18px 0 0; font-size: 14px; color: var(--faint); }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@media (max-width: 480px) { .auth__card { padding: 24px 18px; } }

.form { text-align: left; margin-top: 22px; display: grid; gap: 18px; }
.field { display: grid; gap: 8px; }
.field__label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
.field__label i { color: var(--red); font-style: normal; }
.field input {
  width: 100%; padding: 11px 12px; border: 1px solid transparent; border-radius: 4px;
  background: var(--bg-1); color: var(--text); font: inherit; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--red); }
.field.has-error input { border-color: var(--red); }
.field.has-error .field__label { color: #ff6b72; }
.field__error { color: #ff6b72; font-size: 13px; }
.field__hint { color: var(--faint); font-size: 12px; }
.field__password { position: relative; display: block; }
.field__password input { padding-right: 64px; }
.field__toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--faint); font: 600 12px inherit; font-family: inherit; cursor: pointer; padding: 6px 8px; border-radius: 4px; }
.field__toggle:hover { color: var(--text); background: var(--bg-4); }

/* ---------- Account ---------- */
.account { padding-top: 40px; padding-bottom: 64px; }
.profile { background: var(--bg-2); border-radius: 4px; overflow: hidden; }
.profile__banner { height: 110px; background: linear-gradient(120deg, #8d0a10, var(--red) 55%, #ff5a40); }
.profile__body { display: flex; align-items: flex-end; gap: 18px; padding: 0 24px 22px; margin-top: -40px; flex-wrap: wrap; }
.profile__info { flex: 1; min-width: 200px; }
.profile__info h1 { font-size: 26px; margin: 0; }
.profile__info p { margin: 2px 0 0; }
.avatar { display: grid; place-items: center; border-radius: 50%; background: var(--red); font-weight: 800; color: #fff; }
.avatar--xl { width: 92px; height: 92px; font-size: 38px; border: 6px solid var(--bg-2); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 16px 0; }
.stat { background: var(--bg-2); border-radius: 4px; padding: 18px 20px; display: grid; }
.stat__value { font-size: 26px; font-weight: 800; }
.stat__label { color: var(--muted); font-size: 13px; }
@media (max-width: 640px) { .stats { grid-template-columns: 1fr; } }
.panel { background: var(--bg-2); border-radius: 4px; padding: 22px 24px; }
.panel__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel__head h2 { font-size: 18px; margin: 0; }
.empty { text-align: center; padding: 32px 0 16px; }
.empty img { opacity: .5; filter: grayscale(.3); }
.empty p { margin: 6px 0; }
.game-list { list-style: none; padding: 0; margin: 0; }
.game-list li { display: flex; align-items: center; gap: 14px; padding: 10px 8px; border-radius: 4px; transition: background .15s; }
.game-list li:hover { background: var(--bg-4); }
.game-list__icon { width: 36px; height: 36px; border-radius: 4px; background: var(--red-soft); color: var(--red); display: grid; place-items: center; font-weight: 800; flex: none; }
.game-list__name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-list__date { width: 170px; text-align: right; font-size: 13px; }
@media (max-width: 560px) { .game-list__date { display: none; } }

.error-card__code { font-size: 64px; font-weight: 800; color: var(--red); line-height: 1; }
.error-card .btn { margin-top: 16px; }

/* ---------- Footer ---------- */
.footer { background: var(--bg-1); padding: 28px 0; font-size: 13px; color: var(--faint); }
.footer__inner { max-width: 1140px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Avatars, roles, edit, admin ---------- */
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar--sm { width: 28px; height: 28px; font-size: 13px; flex: none; }
.nav__user { display: inline-flex; align-items: center; gap: 8px; }
@media (max-width: 560px) { .nav__user span:not(.avatar) { display: none; } }
.profile__banner { background-size: cover; background-position: center; }
.profile__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.role { display: inline-block; vertical-align: middle; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 3px 7px; border-radius: 3px; background: var(--bg-4); color: var(--muted); }
.role--admin { background: var(--red); color: #fff; }
.game-list__icon img { width: 100%; height: 100%; object-fit: contain; }
.back { display: inline-block; margin-bottom: 16px; color: var(--muted); }
.page-title { font-size: 28px; margin-bottom: 16px; }
.edit { margin-bottom: 16px; }
.edit h2 { font-size: 18px; margin-bottom: 16px; }
.edit__preview { position: relative; margin-bottom: 48px; }
.edit__banner { display: block; height: 140px; border-radius: 4px; cursor: pointer; background: linear-gradient(120deg, #8d0a10, var(--red) 55%, #ff5a40) center / cover; position: relative; overflow: hidden; }
.edit__avatar { position: absolute; left: 20px; bottom: -40px; cursor: pointer; }
.edit__avatar .avatar { border-color: var(--bg-2); }
.edit__hint { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .55); color: #fff; font-size: 13px; font-weight: 700; opacity: 0; transition: opacity .15s; border-radius: inherit; }
.edit__avatar .edit__hint { border-radius: 50%; inset: 6px; }
.edit__banner:hover .edit__hint, .edit__avatar:hover .edit__hint { opacity: 1; }
.edit__remove { display: flex; gap: 16px; margin-top: 8px; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; cursor: pointer; }
.check input { accent-color: var(--red); }
.edit .form { max-width: 440px; }
.search-form input { height: 34px; padding: 0 10px; border: 1px solid transparent; border-radius: 4px; background: var(--bg-1); color: var(--text); font: inherit; outline: none; }
.search-form input:focus { border-color: var(--red); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; color: var(--faint); font-weight: 700; padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 8px; border-bottom: 1px solid rgba(255, 255, 255, .04); white-space: nowrap; }
.table__user { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.role-form select { height: 30px; padding: 0 8px; border-radius: 4px; border: 0; background: var(--bg-4); color: var(--text); font: inherit; cursor: pointer; }
.role-form select:disabled { opacity: .6; cursor: default; }

/* ---------- Legal & cookies ---------- */
.footer__links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.footer__links a, .linklike { color: var(--muted); font-size: 13px; }
.linklike { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; cursor: pointer; }
.linklike:hover { color: var(--text); text-decoration: underline; }
.legal { display: grid; grid-template-columns: 200px 1fr; gap: 32px; padding-top: 40px; padding-bottom: 64px; }
.legal__nav { display: grid; gap: 2px; align-content: start; position: sticky; top: 84px; }
.legal__nav a { color: var(--muted); padding: 8px 12px; border-radius: 4px; text-decoration: none; }
.legal__nav a:hover { background: var(--bg-4); color: var(--text); }
.legal__nav a.is-active { background: var(--bg-4); color: var(--text); border-left: 3px solid var(--red); }
.legal__body { background: var(--bg-2); border-radius: 4px; padding: 28px 32px; max-width: 820px; min-width: 0; }
.legal__body h1 { font-size: 30px; margin-bottom: 4px; }
.legal__body h2 { font-size: 18px; margin: 28px 0 8px; }
.legal__body p, .legal__body li { color: var(--muted); }
.legal__body ul { padding-left: 20px; }
.legal__date { margin-top: 0; font-size: 13px; }
@media (max-width: 760px) {
  .legal { grid-template-columns: 1fr; gap: 16px; }
  .legal__nav { position: static; grid-auto-flow: column; overflow-x: auto; }
  .legal__body { padding: 20px 16px; }
}
.cookie {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 40; max-width: 760px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: 4px; background: var(--bg-0);
  border: 1px solid var(--line); animation: drop .3s var(--ease);
}
.cookie[hidden] { display: none; }
.cookie__text p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.cookie__actions { display: flex; gap: 8px; flex: none; }
@media (max-width: 620px) { .cookie { flex-direction: column; align-items: stretch; } .cookie__actions .btn { flex: 1; } }
.game-list__nick { display: block; font-size: 12px; font-weight: 500; color: var(--faint); }
