:root {
  color-scheme: dark;
  --bg: #0e0d0c;
  --bg-2: #151311;
  --panel: #1b1916;
  --panel-2: #23201c;
  --line: #2f2b26;
  --line-2: #3d3832;
  --text: #ece6dd;
  --muted: #9a9187;
  --dim: #6d665e;
  --accent: #ce422b;
  --accent-2: #e8603f;
  --accent-soft: rgba(206, 66, 43, 0.14);
  --ok: #6fbf5a;
  --ok-soft: rgba(111, 191, 90, 0.14);
  --warn: #e0a83a;
  --warn-soft: rgba(224, 168, 58, 0.14);
  --info: #5aa2d6;
  --info-soft: rgba(90, 162, 214, 0.14);
  --radius: 10px;
  --head: 'Russo One', 'Arial Black', sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--head); font-weight: 400; letter-spacing: 0.02em; margin: 0 0 12px; line-height: 1.15; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
main { flex: 1; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; stroke-width: 2; }
.btn .icon { width: 16px; height: 16px; vertical-align: 0; }
.btn-lg .icon { width: 18px; height: 18px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.hidden { display: none !important; }

/* ---------- шапка ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(14, 13, 12, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--head); font-size: 20px; letter-spacing: 0.04em; }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #7e2416);
  display: grid; place-items: center; font-size: 15px; color: #fff;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08) inset;
}
.logo b { color: var(--accent-2); font-weight: 400; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: var(--muted); padding: 8px 12px; border-radius: 7px; font-weight: 500; }
.nav a:hover, .nav a.active { color: var(--text); background: var(--panel); text-decoration: none; }
.userbox { display: flex; align-items: center; gap: 10px; }
.userbox .avatar { width: 34px; height: 34px; }
.userbox .uname { font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .burger { display: none; }

/* ---------- кнопки, формы ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  font: 600 14px var(--body); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #2c2823; border-color: #4a443c; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost { background: transparent; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 50px; padding: 0 24px; font-size: 16px; }
.btn-steam { background: #171a21; border-color: #2a475e; }
.btn-steam:hover { background: #1b2838; border-color: #66c0f4; }
.btn-ok { background: var(--ok-soft); border-color: rgba(111,191,90,.4); color: #a6e391; }
.btn-danger { background: var(--accent-soft); border-color: rgba(206,66,43,.45); color: #ff9a85; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
input, select, textarea {
  width: 100%; background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px;
  font: 14px var(--body); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 96px; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }

/* ---------- карточки ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.avatar { border-radius: 8px; background: var(--panel-2); object-fit: cover; flex: none; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line-2); white-space: nowrap;
}
.badge.red { background: var(--accent-soft); color: #ff9a85; border-color: rgba(206,66,43,.35); }
.badge.green { background: var(--ok-soft); color: #a6e391; border-color: rgba(111,191,90,.35); }
.badge.yellow { background: var(--warn-soft); color: #f2c76e; border-color: rgba(224,168,58,.35); }
.badge.blue { background: var(--info-soft); color: #93c8ee; border-color: rgba(90,162,214,.35); }
.role-owner { background: linear-gradient(90deg, rgba(206,66,43,.25), rgba(224,168,58,.2)); color: #ffc6a8; border-color: rgba(232,96,63,.5); }
.role-admin { background: var(--accent-soft); color: #ff9a85; border-color: rgba(206,66,43,.35); }
.role-moderator { background: var(--info-soft); color: #93c8ee; border-color: rgba(90,162,214,.35); }

/* ---------- герой ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: 110px 0 90px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(900px 420px at 80% -10%, rgba(206,66,43,.28), transparent 60%),
    radial-gradient(700px 400px at 0% 110%, rgba(224,168,58,.10), transparent 60%),
    repeating-linear-gradient(135deg, rgba(255,255,255,.018) 0 2px, transparent 2px 14px),
    var(--bg);
}
.hero h1 { font-size: clamp(44px, 8vw, 88px); margin-bottom: 18px; }
.hero h1 b { color: var(--accent); font-weight: 400; }
.hero p.lead { font-size: 19px; color: var(--muted); max-width: 620px; margin: 0 0 32px; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 36px; margin-top: 54px; flex-wrap: wrap; }
.hero-stats div { font-family: var(--head); font-size: 30px; }
.hero-stats span { display: block; font: 500 13px var(--body); color: var(--muted); }

.section { padding: 72px 0; scroll-margin-top: 40px; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.section-title h2 { font-size: 34px; margin: 0; }
.section-title p { margin: 6px 0 0; color: var(--muted); }

/* ---------- сервера ---------- */
.servers { display: grid; gap: 16px; }
.server {
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
  background: linear-gradient(90deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line); border-radius: 14px; padding: 24px 26px;
  position: relative; overflow: hidden;
}
.server::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.server.offline::before { background: var(--dim); }
.server-name { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.server-name h3 { font-size: 24px; margin: 0; }
.server-mode, .server-tag { font-family: var(--head); font-size: 13px; padding: 4px 10px; border-radius: 6px; letter-spacing: .06em; text-transform: uppercase; }
.server-mode { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line-2); }
.server-tag { background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); }
.mode-modded .server-mode { background: var(--accent); border-color: var(--accent); color: #fff; }
.mode-vanilla .server-mode { background: var(--ok-soft); border-color: rgba(111,191,90,.4); color: #a6e391; }
.server.mode-vanilla::before { background: var(--ok); }
.server-meta .icon { color: var(--dim); }
.server-desc { color: var(--muted); margin: 0 0 14px; }
.server-meta { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--muted); align-items: center; }
.server-meta b { color: var(--text); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--dim); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.online-bar { width: 220px; }
.online-bar .num { font-family: var(--head); font-size: 22px; }
.online-bar .num small { font: 500 13px var(--body); color: var(--muted); }
.bar { height: 6px; background: var(--panel-2); border-radius: 99px; overflow: hidden; margin: 6px 0 14px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--warn)); border-radius: 99px; }
.server-actions { display: flex; gap: 8px; }
.server-actions .btn-primary { flex: 1; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.feature { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.feature .ico { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-2); margin-bottom: 14px; border: 1px solid rgba(206,66,43,.25); }
.feature .ico .icon { width: 22px; height: 22px; vertical-align: 0; }
.feature h3 { font-size: 18px; margin-bottom: 6px; }
.feature p { color: var(--muted); margin: 0; }

.howto { counter-reset: s; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.howto li { list-style: none; counter-increment: s; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 20px 20px 64px; position: relative; color: var(--muted); }
.howto li b { color: var(--text); display: block; margin-bottom: 4px; }
.howto li::before { content: counter(s); position: absolute; left: 18px; top: 18px; width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: var(--head); }
.howto { padding: 0; margin: 0; }

footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--dim); font-size: 13px; margin-top: 40px; }
footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- кабинет / админка ---------- */
.page { padding-top: 36px; padding-bottom: 20px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 32px; margin: 0; }
.grid-2 { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
.grid-even { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; align-items: start; }
.profile { text-align: center; }
.profile .avatar { width: 96px; height: 96px; border-radius: 14px; margin-bottom: 12px; }
.profile h2 { font-size: 22px; margin-bottom: 6px; word-break: break-word; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; text-align: left; font-size: 13px; margin-top: 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; word-break: break-all; }

.alert { border-radius: var(--radius); padding: 16px 18px; border: 1px solid; display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.alert.red { background: var(--accent-soft); border-color: rgba(206,66,43,.5); }
.alert .alert-ico { color: #ff9a85; flex: none; }
.alert .alert-ico .icon { width: 24px; height: 24px; vertical-align: 0; }
.alert h3 { font-size: 17px; margin: 0 0 4px; }
.alert p { margin: 0; color: var(--muted); }

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 8px;
  border: 1px solid transparent; cursor: pointer; color: var(--text);
}
.list-item:hover { background: var(--panel-2); border-color: var(--line); text-decoration: none; }
.list-item + .list-item { border-top-color: var(--line); }
.list-item:hover + .list-item { border-top-color: transparent; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .sub { font-size: 12px; color: var(--muted); }
.empty { text-align: center; padding: 34px 10px; color: var(--dim); }

.chat { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.msg { display: flex; gap: 12px; }
.msg .avatar { width: 36px; height: 36px; }
.msg-body { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; flex: 1; min-width: 0; }
.msg.staff .msg-body { background: rgba(206,66,43,.08); border-color: rgba(206,66,43,.3); }
.msg-head { display: flex; gap: 8px; align-items: center; font-size: 13px; margin-bottom: 4px; flex-wrap: wrap; }
.msg-head b { font-weight: 600; }
.msg-text { white-space: pre-wrap; word-break: break-word; }

/* ---------- админка ---------- */
.admin-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px; align-items: start; padding: 28px 0 10px; }
.grid-2 > *, .admin-layout > * { min-width: 0; }
.sidenav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; }
.sidenav .icon { width: 18px; height: 18px; vertical-align: 0; opacity: .85; }
.sidenav button.active .icon { color: var(--accent-2); opacity: 1; }
.sidenav button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: 0; color: var(--muted); text-align: left;
  padding: 10px 12px; border-radius: 8px; font: 500 14px var(--body); cursor: pointer;
}
.sidenav button:hover { background: var(--panel); color: var(--text); }
.sidenav button.active { background: var(--panel-2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.sidenav .count { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.sidenav .count:empty { display: none; }
.sidenav hr { border: 0; border-top: 1px solid var(--line); margin: 10px 4px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; cursor: pointer; }
.stat:hover { border-color: var(--line-2); }
.stat .v { font-family: var(--head); font-size: 32px; line-height: 1.1; }
.stat .l { font-size: 13px; color: var(--muted); }
.stat.hot .v { color: var(--accent-2); }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; height: 36px; padding: 6px 10px; }
.tabs { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 6px 12px; border-radius: 6px; font: 500 13px var(--body); cursor: pointer; }
.tabs button.active { background: var(--panel-2); color: var(--text); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); background: var(--bg-2); padding: 10px 14px; white-space: nowrap; }
td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: top; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--panel-2); }
td .who { display: flex; align-items: center; gap: 10px; min-width: 160px; }
td .who .avatar { width: 30px; height: 30px; border-radius: 6px; }
td .who small { display: block; color: var(--dim); font-family: var(--mono); font-size: 11px; }

.contact { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.contact .btn-sm { height: 26px; padding: 0 7px; }
.contact .dim { flex-basis: 100%; }
.kv dd .contact { justify-content: flex-end; text-align: right; }

/* ---------- выбор игрока для проверки ---------- */
.player-list { max-height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); }
.player-row, .picked { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; text-align: left; color: var(--text); font: inherit; }
.player-row { background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.player-row:last-child { border-bottom: 0; }
.player-row:hover:not(:disabled) { background: var(--panel-2); }
.player-row:disabled { cursor: not-allowed; opacity: .55; }
.player-row .avatar { width: 40px; height: 40px; }
.player-row .grow, .picked .grow { flex: 1; min-width: 0; }
.player-row .title, .picked .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-row .sub, .picked .sub { font-size: 12px; color: var(--muted); }
.picked { background: var(--accent-soft); border: 1px solid rgba(206,66,43,.4); border-radius: var(--radius); }
.picked .avatar { width: 48px; height: 48px; }

/* ---------- модалка, тосты ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; width: 100%; max-width: 640px; max-height: calc(100vh - 40px); overflow: auto; padding: 22px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-size: 22px; }
.x { background: none; border: 0; color: var(--muted); font-size: 24px; cursor: pointer; line-height: 1; }
.x:hover { color: var(--text); }

#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 4px solid var(--ok); padding: 12px 16px; border-radius: 8px; min-width: 240px; max-width: 360px; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: in .2s ease-out; }
.toast.err { border-left-color: var(--accent); }
@keyframes in { from { opacity: 0; transform: translateY(8px); } }

.gate { max-width: 460px; margin: 80px auto; text-align: center; }
.gate .ico { width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-2); border: 1px solid rgba(206,66,43,.3); }
.gate .ico .icon { width: 34px; height: 34px; vertical-align: 0; }
.gate p { color: var(--muted); }

@media (max-width: 900px) {
  .grid-2, .admin-layout { grid-template-columns: 1fr; }
  .sidenav { position: static; flex-direction: row; overflow-x: auto; gap: 4px; }
  .sidenav button { width: auto; white-space: nowrap; }
  .sidenav hr { display: none; }
  .server { grid-template-columns: 1fr; }
  .online-bar { width: 100%; }
}
@media (max-width: 680px) {
  .wrap { padding: 0 16px; }
  .topbar .wrap { gap: 12px; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; background: var(--bg-2); border-bottom: 1px solid var(--line); padding: 8px 16px 14px; }
  .nav.open { display: flex; }
  .topbar .burger { display: inline-flex; margin-left: auto; }
  .userbox .uname, .hide-sm { display: none; }
  .hero { padding: 70px 0 60px; }
  .hero-stats { gap: 24px; }
  .section { padding: 52px 0; }
  .server { padding: 20px; }
  .server-actions { flex-wrap: wrap; }
}
