:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --text: #1c1f24;
  --muted: #5f6672;
  --accent: #1f6feb;
  --danger: #c62828;
  --border: #d6d9de;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --panel: #1b1e24;
    --text: #e8eaed;
    --muted: #9aa1ac;
    --accent: #4c8dff;
    --danger: #ef5350;
    --border: #2d323b;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
#connect-view {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#connect-form {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
h1 { margin: 0 0 4px; font-size: 22px; }
label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
input, select, button {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
}
button { cursor: pointer; }
button[type=submit] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button:disabled { opacity: .6; cursor: default; }
#status { margin: 0; min-height: 1.4em; color: var(--muted); }
#status.error { color: var(--danger); }
#recent { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
#recent button { width: 100%; text-align: left; }

#session-view { position: fixed; inset: 0; display: flex; flex-direction: column; background: #000; }
#session-view[hidden] { display: none; }
#toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 4px 8px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
#toolbar select, #toolbar button { padding: 3px 8px; font-size: 13px; }
#session-title { font-weight: 600; margin-right: auto; }
#stage { position: relative; flex: 1; min-height: 0; }
#video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
  outline: none;
  touch-action: none;
}
#stats {
  position: absolute;
  top: 8px;
  left: 8px;
  margin: 0;
  padding: 6px 8px;
  background: rgba(0, 0, 0, .7);
  color: #9f9;
  font: 12px/1.35 ui-monospace, Menlo, Consolas, monospace;
  pointer-events: none;
  border-radius: 4px;
}
#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(0, 0, 0, .55);
  font-size: 18px;
  text-align: center;
  padding: 16px;
}
#overlay[hidden], #stats[hidden] { display: none; }
