:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --line: #2a2f3a;
  --text: #e8eaf0;
  --muted: #8b93a5;
  --twitch: #9146ff;
  --twitch-2: #a970ff;
  --green: #5fd068;
  --red: #ff5c6c;
  --yellow: #ffcc4d;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100vh; }
h1 { font-size: 26px; margin: 0 0 6px; }
h2 { font-size: 16px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.muted { color: var(--muted); }
.small { font-size: 13px; font-weight: 400; }
[hidden] { display: none !important; }

.top {
  display: flex; align-items: center; gap: 16px; padding: 12px 20px;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: inherit; text-decoration: none; }
.block { width: 18px; height: 18px; background: linear-gradient(#79c05a 35%, #7a5a3a 35%); border-radius: 3px; }
.status { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status.on .dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status.off .dot { background: var(--red); }
.account { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.account img { width: 28px; height: 28px; border-radius: 50%; }

.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 20px;
  max-width: 1180px; margin: 0 auto; padding: 20px;
}
.col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.hero { background: linear-gradient(135deg, #1f1830, var(--panel) 60%); }

.address { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.address code {
  font-size: 18px; padding: 10px 14px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; user-select: all; overflow-wrap: anywhere;
}

.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--twitch); color: #fff; font: inherit; font-weight: 600;
  padding: 9px 16px; border-radius: 8px;
}
.btn:hover { background: var(--twitch-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.ghost:hover { border-color: var(--twitch); }
.btn.danger { background: transparent; border: 1px solid var(--line); color: var(--red); padding: 5px 10px; font-size: 13px; }

.alert { padding: 12px 16px; border-radius: 10px; border: 1px solid; }
.alert.err { border-color: var(--red); background: #2a1519; }
.alert.ok { border-color: var(--green); background: #15291a; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; display: flex; flex-direction: column; gap: 16px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 34px 1fr; column-gap: 12px; }
.steps li::before {
  content: counter(s); grid-row: span 2; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line); font-weight: 700;
}
.steps li.done::before { content: "✓"; background: var(--green); border-color: var(--green); color: #0b1a0d; }
.step-title { font-weight: 600; }
.step-body { margin-top: 6px; }

.code-form { display: flex; gap: 10px; flex-wrap: wrap; }
.code-form input {
  font: 600 20px ui-monospace, Consolas, monospace; letter-spacing: 4px; text-transform: uppercase;
  width: 180px; padding: 8px 12px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
}
.linked { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.linked img { width: 32px; height: 32px; image-rendering: pixelated; border-radius: 4px; }

.badge { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; text-transform: uppercase; }
.badge.sub { background: var(--twitch); color: #fff; }
.badge.follower { background: var(--panel-2); color: var(--twitch-2); border: 1px solid var(--twitch); }
.badge.owner { background: var(--yellow); color: #221a00; }

.mods { margin: 0; padding-left: 20px; }
.mods a { color: var(--twitch-2); }

.player-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.player-list li {
  display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px;
  background: var(--panel-2); border-radius: 999px; font-size: 14px;
}
.player-list img { width: 22px; height: 22px; border-radius: 50%; image-rendering: pixelated; }
.player-list .empty { background: none; color: var(--muted); padding: 0; }
.count { background: var(--panel-2); border-radius: 999px; padding: 0 8px; font-size: 13px; }

.chat { display: flex; flex-direction: column; height: 560px; }
.messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 4px; }
.msg { overflow-wrap: anywhere; }
.msg .time { color: var(--muted); font-size: 12px; margin-right: 6px; }
.msg .src { font-size: 11px; margin-right: 4px; color: var(--muted); }
.msg .author { font-weight: 600; margin-right: 4px; }
.msg.web .author { color: var(--twitch-2); }
.msg.game .author { color: var(--green); }
.msg.system { color: var(--muted); font-style: italic; font-size: 14px; }
.chat-form { display: flex; gap: 8px; margin-top: 12px; }
.chat-form input {
  flex: 1; min-width: 0; padding: 9px 12px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; font: inherit;
}
.chat-login { margin-top: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; }
.admin { max-width: 1180px; margin: 0 auto; padding: 20px; display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row input { flex: 1; min-width: 200px; padding: 9px 12px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font: inherit; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .chat { height: 460px; }
  .top { flex-wrap: wrap; padding: 12px 16px; }
}
