:root {
  --bg: #0f1115;
  --panel: #181b22;
  --line: #262a33;
  --text: #e6e8ec;
  --muted: #8b919c;
  --accent: #4f8cff;
  --accent-text: #fff;
  --live: #e5484d;
  --error: #ff6b6b;
  --warn: #f0b429;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[hidden] { display: none !important; }
h1 { font-size: 22px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--error); }
.warn { color: var(--warn); }
.row { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }

.card-view {
  max-width: 560px;
  margin: 8vh auto;
  padding: 24px 16px;
}

form { display: grid; gap: 14px; margin-top: 18px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
input {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
#join-code { font-family: ui-monospace, Consolas, monospace; letter-spacing: 0.5px; }

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  padding: 9px 16px;
  background: var(--accent);
  color: var(--accent-text);
}
button:hover { filter: brightness(1.1); }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.ghost.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

#streams { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 10px; }
.stream {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}
.stream .info { flex: 1; min-width: 0; }
.stream .who { font-weight: 600; }
.stream .what, .stream .meta { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); flex: none; }

/* ---- watching ---- */
#watch { position: fixed; inset: 0; background: #000; }
#stage { position: absolute; inset: 0; background: #000; }
#screen { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
#stage.idle { cursor: none; }
#overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
#overlay-text {
  background: rgba(0, 0, 0, 0.6);
  padding: 10px 16px;
  border-radius: 8px;
  max-width: 80%;
  text-align: center;
}
#hud {
  position: absolute; top: 8px; left: 8px;
  font: 12px/1.4 ui-monospace, Consolas, monospace;
  background: rgba(0, 0, 0, 0.55);
  padding: 4px 8px;
  border-radius: 6px;
  white-space: pre;
  pointer-events: none;
}
#controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  transition: opacity 0.2s;
}
#stage.idle #controls, #stage.idle #hud.auto-hide { opacity: 0; pointer-events: none; }
#controls button { padding: 6px 12px; font-size: 13px; }
#layers { display: flex; gap: 4px; flex-wrap: wrap; }
#volume { width: 90px; padding: 0; accent-color: var(--accent); background: transparent; border: 0; }
