:root {
  --bg: #0b0b10; --bg2: #14141c; --card: #181822; --line: #2a2a38;
  --text: #f2f2f6; --muted: #9a9ab0; --accent: #25f4ee; --accent2: #fe2c55;
  --ok: #2ee6a6; --warn: #ffb020; --err: #ff5470; --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #22143a 0%, var(--bg) 55%);
  color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  min-height: 100vh;
}
body.centered { display: grid; place-items: center; padding: 24px; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; }
h2 { font-size: 1.15rem; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.accent { color: var(--accent); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 1.6rem; }
.logo { font-size: 1.6rem; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); background: rgba(11,11,16,.8); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; }
.topbar nav { display: flex; align-items: center; gap: 8px; }
.container { max-width: 980px; margin: 0 auto; padding: 18px; display: grid; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.auth-card { width: min(420px, 100%); }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.gap, .gap { gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.end { align-items: flex-end; }
.inline { display: inline; }
.chip { background: #23233a; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: .85rem; }

.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 6px; font-size: .9rem; color: var(--muted); }
.form label.check { grid-auto-flow: column; align-items: center; justify-content: start; }
input:not([type=checkbox]) {
  width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; color: var(--text);
  padding: 10px 12px; font-size: 1rem; outline: none;
}
input:focus { border-color: var(--accent); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; border: 1px solid var(--line);
  background: #22223a; color: var(--text); padding: 10px 16px; border-radius: 10px; font-size: .95rem; font-weight: 600; text-decoration: none;
  transition: transform .06s ease, filter .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent2), #ff6a88); border-color: transparent; color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { background: #3a1b25; border-color: #5a2436; color: #ff8da1; }
.btn.small { padding: 6px 10px; font-size: .85rem; }
.btn.test { background: var(--bg2); }
.alert { padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-size: .92rem; }
.alert.error { background: #3a1b25; border: 1px solid #5a2436; color: #ffb3c0; }
.alert.ok { background: #143327; border: 1px solid #1f5a42; color: #a6f0d0; }

.status-line { display: flex; align-items: center; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: .85rem; font-weight: 700; background: #2a2a38; }
.pill.connected { background: #143327; color: var(--ok); }
.pill.connecting, .pill.reconnecting { background: #3a2f14; color: var(--warn); }
.pill.offline, .pill.ended { background: #2d2440; color: #c9b3ff; }
.pill.error, .pill.ratelimited { background: #3a1b25; color: var(--err); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; }
.stat .k { color: var(--muted); font-size: .8rem; }
.stat .v { font-size: 1.35rem; font-weight: 800; }

.games { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.game { display: grid; grid-template-rows: auto 1fr; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.game-thumb { display: grid; place-items: center; aspect-ratio: 16 / 9; background: #0d0d16 center / cover no-repeat; position: relative; text-decoration: none; }
.game-thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(11,11,16,.85), rgba(11,11,16,0) 60%); }
.game-thumb .game-icon { position: relative; z-index: 1; font-size: 2.6rem; filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }
.game-body { padding: 14px; display: flex; flex-direction: column; }
.game-body .btn { margin-top: auto; align-self: flex-start; }
.howto { margin: 6px 0 12px; padding-left: 18px; color: var(--muted); font-size: .88rem; }
.steps { padding-left: 20px; color: var(--muted); }
.steps li { margin-bottom: 6px; }
.steps b { color: var(--text); }

.test-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 10px; }
.feed { list-style: none; margin: 0; padding: 0; max-height: 380px; overflow: auto; font-size: .9rem; display: grid; gap: 4px; }
.feed li { padding: 6px 10px; border-radius: 8px; background: var(--bg2); border: 1px solid var(--line); word-break: break-word; }
.feed li time { color: var(--muted); font-size: .78rem; margin-right: 6px; }
.feed li.gift { border-color: #6a3a7a; background: #26182e; }
.feed li.like { border-color: #5a2436; }
.feed li.follow, .feed li.share { border-color: #1f5a42; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.table .actions input { width: 130px; padding: 6px 8px; font-size: .85rem; }

@media (max-width: 600px) {
  .container { padding: 12px; }
  .card { padding: 14px; }
}
