:root {
  --bg: #0f1419;
  --card: #1a2129;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #f0a63a;
  --ok: #3fb950;
  --danger: #e5534b;
  --border: #2d3742;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
}
header {
  display: flex; gap: 16px; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
}
#status-line { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }
.view { flex: 1; min-height: 0; }
#home, #host {
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; align-items: flex-start;
  padding: 32px 16px;
}
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; width: 100%; max-width: 380px;
}
.card h2 { margin: 0 0 8px; font-size: 18px; }
.muted { color: var(--muted); }
a { color: var(--accent); word-break: break-all; }
button {
  background: var(--border); color: var(--text); border: 0; border-radius: 8px;
  padding: 9px 14px; font: inherit; cursor: pointer;
}
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); color: #1a1200; font-weight: 600; }
button.danger { background: var(--danger); color: #fff; }
button.active { background: var(--ok); color: #04160a; font-weight: 600; }
input {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 12px; font: inherit;
}
#form-join { display: flex; gap: 8px; }
#join-code { flex: 1; min-width: 0; font-size: 20px; letter-spacing: 4px; text-align: center; }
.code { font-size: 44px; font-weight: 700; letter-spacing: 8px; color: var(--accent); text-align: center; }
.checks { list-style: none; padding: 0; }
.checks li::before { content: "○ "; color: var(--muted); }
.checks li.on::before { content: "● "; color: var(--ok); }
.toggle { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; cursor: pointer; }
.toggle input { margin-top: 4px; width: 18px; height: 18px; }
.warn { color: var(--accent); font-size: 13px; }
details { margin: 12px 0 16px; color: var(--muted); }

#viewer { display: flex; flex-direction: column; position: relative; }
.toolbar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 8px 16px; border-bottom: 1px solid var(--border);
}
.spacer { flex: 1; }
.stage { flex: 1; min-height: 0; position: relative; background: #000; }
#remote { width: 100%; height: 100%; object-fit: contain; outline: none; display: block; }
#remote.controlling { cursor: crosshair; box-shadow: inset 0 0 0 3px var(--ok); }
.waiting { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }

.chat { display: flex; flex-direction: column; gap: 8px; }
.chat-log { height: 220px; overflow-y: auto; font-size: 14px; }
.chat-log p { margin: 0 0 6px; }
.chat-log b { color: var(--accent); }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; min-width: 0; }
.chat-floating {
  position: absolute; right: 16px; bottom: 16px; max-width: 320px; padding: 12px; opacity: .92;
}
.chat-floating .chat-log { height: 120px; }
a.button {
  display: inline-block; background: var(--ok); color: #04160a; font-weight: 600;
  text-decoration: none; border-radius: 8px; padding: 9px 14px; margin: 4px 0;
}
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0 12px; }
.steps { margin: 12px 0 16px; }
.steps ol { padding-left: 20px; }
.steps li { margin-bottom: 8px; }
