:root {
  color-scheme: dark;
  --bg: #0e0e10;
  --panel: #18181b;
  --border: #2a2a2e;
  --fg: #efeff1;
  --muted: #888;
  --accent: #a78bfa;
  --twitch: #9147ff;
  --google: #4285f4;
  --discord: #5865f2;
  --good: #4ade80;
  --warn: #facc15;
  --bad: #f87171;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.brand { color: var(--fg); font-weight: 700; }
nav { display: flex; gap: 12px; align-items: center; }
nav button {
  background: transparent; border: 1px solid var(--border); color: inherit;
  padding: 4px 10px; border-radius: 4px; cursor: pointer;
}
main { min-height: calc(100vh - 56px); }
button {
  background: var(--twitch); color: white; border: 0; padding: 6px 12px;
  border-radius: 4px; cursor: pointer; font: inherit;
}
button.danger { background: #b91c1c; }
input, select, textarea {
  background: #0f0f10; border: 1px solid var(--border); color: inherit;
  padding: 6px 8px; border-radius: 4px; font: inherit;
}
fieldset { border: 1px solid var(--border); border-radius: 4px; padding: 8px; }
fieldset legend { padding: 0 4px; color: var(--muted); }
.error { color: var(--bad); }
.layout {
  display: grid; grid-template-columns: 1fr 340px;
  height: calc(100vh - 56px);
}
.stage {
  display: flex; align-items: center; justify-content: center;
  background: #000; overflow: hidden;
}
.player {
  width: 100%; height: 100%; aspect-ratio: 16/9; border: 0; display: block;
}
.placeholder {
  width: 100%; aspect-ratio: 16/9; display: grid; place-items: center;
  background: #111; color: var(--muted);
}
.chat-pane { min-height: 0; }
.chat {
  display: flex; flex-direction: column; height: 100%;
  background: var(--panel); border-left: 1px solid var(--border);
}
.chat .header {
  display: flex; justify-content: space-between; padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em;
}
.chat .messages {
  flex: 1; overflow-y: auto; padding: 8px 12px; font-size: 14px; line-height: 1.45;
}
.chat .msg { padding: 2px 4px; word-wrap: break-word; border-radius: 3px; }
.chat .msg.mention { background: rgba(167,139,250,.12); border-left: 3px solid var(--accent); padding-left: 6px; }
.chat .msg.system { color: var(--warn); font-style: italic; }
.chat .name { font-weight: 600; color: var(--accent); margin-right: 4px; }
.chat .name::after { content: ':'; }
.chat .emote { height: 28px; vertical-align: middle; margin: 0 2px; }
.chat .link { color: #60a5fa; text-decoration: underline; word-break: break-all; }
.chat .composer { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--border); }
.chat .composer textarea {
  flex: 1; resize: none; background: #0f0f10; border: 1px solid var(--border);
  color: inherit; padding: 8px; border-radius: 4px;
}
.chat .signin { padding: 10px; text-align: center; border-top: 1px solid var(--border); }
.chat .err {
  background: #7f1d1d; color: #fee2e2; padding: 6px 12px; font-size: 12px;
}
.chat .modtools {
  display: inline-flex; gap: 2px; margin-right: 6px; opacity: 0.3;
  transition: opacity 0.1s;
}
.chat .msg:hover .modtools { opacity: 1; }
.chat .modtools button {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 0 4px; font-size: 12px;
}
.chat .modtools button:hover { color: var(--bad); border-color: var(--bad); }
.badge {
  display: inline-block; color: white; font-size: 10px;
  padding: 1px 4px; border-radius: 3px; margin-right: 4px; font-weight: 700;
}
.badge.mod { background: #16a34a; }
.badge.sub { background: #6441a5; }
.badge.discord { background: #5865f2; }
.badge.ok { background: #16a34a; }
.badge.warn { background: #b45309; }
.status-open { color: var(--good); }
.status-connecting { color: var(--warn); }
.status-closed { color: var(--bad); }

.form-wrap { max-width: 400px; margin: 60px auto; padding: 0 16px; }
.form-wrap form { display: flex; flex-direction: column; gap: 12px; }
.form-wrap label { display: flex; flex-direction: column; gap: 4px; }
.form-wrap button { padding: 10px; }
.oauth { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.btn {
  display: block; text-align: center; padding: 10px; border-radius: 4px; color: white;
}
.btn.twitch { background: var(--twitch); }
.btn.google { background: var(--google); }
.btn.discord { background: var(--discord); }

.account, .mod {
  max-width: 1100px; margin: 0 auto; padding: 16px 20px;
}
.mod h2, .account h2 {
  margin-top: 28px; font-size: 16px; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--accent);
}
.row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.row input, .row select { flex: 1; min-width: 120px; }
.list, .msglist, .audit, .connections {
  list-style: none; padding: 0; margin: 0;
}
.list li, .msglist li, .audit li, .connections li {
  display: flex; gap: 10px; align-items: center;
  padding: 6px 0; border-bottom: 1px solid #1f1f23; flex-wrap: wrap;
}
.hint { color: var(--muted); }
.meta { color: var(--muted); font-size: 12px; flex: 1; }
.ts { color: #666; font-size: 12px; font-variant-numeric: tabular-nums; }
.action { color: var(--warn); font-weight: 600; }
.config { display: flex; flex-direction: column; gap: 14px; max-width: 480px; }
.config textarea, .config input[type="number"] { width: 100%; max-width: 480px; }
code { background: #0f0f10; padding: 2px 6px; border-radius: 3px; font-size: 12px; color: #d4d4d8; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; }
  .chat-pane { height: 60vh; }
}
