:root {
  --bg: #111111;
  --panel: #1a1a1a;
  --panel-2: #242424;
  --line: #2e2e2e;
  --text: #e6e6e6;
  --muted: #8c8c8c;
  --strong: #ffffff;
  --live: #d64545;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { display: flex; flex-direction: column; }
[hidden] { display: none !important; }

.icon { width: 1em; height: 1em; flex: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .55em 1em; border-radius: 6px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: #2e2e2e; }
.btn.primary { background: #e6e6e6; color: #111; border-color: #e6e6e6; }
.btn.primary:hover { background: #fff; }
.btn.discord { width: 100%; }
.btn.discord .icon { width: 1.15em; height: 1.15em; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1.1rem; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { font-weight: 800; font-size: 1.1rem; letter-spacing: .02em; color: var(--strong); }
.brand span { color: var(--muted); font-weight: 600; }
.status { display: flex; align-items: center; gap: .9rem; font-size: .9rem; }
.badge { display: inline-flex; align-items: center; gap: .45em; padding: .25em .6em; border-radius: 4px; font-weight: 700; font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; background: var(--panel-2); color: var(--muted); }
.badge::before { content: ""; width: .5em; height: .5em; border-radius: 50%; background: currentColor; }
.badge.live { color: var(--strong); }
.badge.live::before { background: var(--live); }
.viewers { display: inline-flex; align-items: center; gap: .4em; color: var(--muted); }

.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 360px; }
.player { position: relative; background: #000; display: flex; align-items: center; justify-content: center; min-height: 0; }
.player video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.offline-screen {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center;
  background: radial-gradient(circle at 50% 40%, #262626, #0a0a0a 70%);
}
.offline-title { font-size: 1.5rem; font-weight: 800; color: var(--strong); }
.offline-sub { color: var(--muted); margin-top: .4rem; }
.unmute {
  position: absolute; left: 1rem; bottom: 1rem; display: inline-flex; align-items: center; gap: .5em;
  padding: .6em 1em; border-radius: 6px; border: 1px solid rgba(255,255,255,.15);
  background: rgba(17,17,17,.85); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.unmute .icon { width: 1.15em; height: 1.15em; }

.chat { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-left: 1px solid var(--line); }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; border-bottom: 1px solid var(--line); font-weight: 700; }
.me { display: flex; align-items: center; gap: .5rem; font-weight: 500; font-size: .85rem; color: var(--muted); }
.me button { background: none; border: 0; color: var(--muted); cursor: pointer; text-decoration: underline; font: inherit; padding: 0; }
.me button:hover { color: var(--text); }
.messages { flex: 1; overflow-y: auto; margin: 0; padding: .5rem .8rem; list-style: none; }
.msg { display: flex; gap: .55rem; padding: .35rem .2rem; border-radius: 4px; position: relative; }
.msg:hover { background: var(--panel-2); }
.msg .avatar { width: 26px; height: 26px; border-radius: 50%; flex: none; margin-top: 1px; object-fit: cover; }
.msg .avatar.blank { display: flex; align-items: center; justify-content: center; background: #3a3a3a; color: #bdbdbd; font-size: .75rem; font-weight: 700; }
.msg .body { min-width: 0; overflow-wrap: anywhere; line-height: 1.35; font-size: .93rem; }
.msg .name { font-weight: 700; margin-right: .35rem; color: #b5b5b5; }
.msg.admin .name { color: var(--strong); }
.msg .tools { display: none; position: absolute; right: .3rem; top: .25rem; gap: .25rem; }
.msg:hover .tools { display: flex; }
.msg .tools button { font-size: .72rem; padding: .15em .45em; border-radius: 4px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); cursor: pointer; }
.msg .tools button:hover { color: var(--text); border-color: #555; }
.system { color: var(--muted); font-size: .85rem; font-style: italic; padding: .3rem .2rem; }
.chat-error { padding: .4rem 1rem; color: #e08a8a; font-size: .85rem; }
.chat-form { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid var(--line); }
.chat-form input {
  flex: 1; min-width: 0; padding: .6em .8em; border-radius: 6px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit;
}
.chat-form input:focus { outline: 1px solid #6a6a6a; border-color: #6a6a6a; }
.chat-login { padding: .7rem; border-top: 1px solid var(--line); }
.chat-login.muted { color: var(--muted); font-size: .9rem; text-align: center; }

.gate { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; background: rgba(8,8,8,.97); padding: 1rem; }
.gate-card { max-width: 420px; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 2rem; }
.gate-card h1 { margin-top: 0; color: var(--strong); }
.gate-card p { color: var(--muted); }
.gate-actions { display: flex; gap: .7rem; justify-content: center; margin-top: 1.3rem; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .player { aspect-ratio: 16 / 9; height: auto; }
  .chat { border-left: 0; border-top: 1px solid var(--line); }
}
