:root {
  color-scheme: light dark;
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #16181d;
  --muted: #5d6470;
  --line: #d5d9e0;
  --accent: #1f5fbf;
  --accent-text: #ffffff;
  --error: #b3261e;
  --stage: #202020;
  --bar: #2b2b2b;
  --bar-text: #e6e6e6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181b;
    --card: #222428;
    --text: #eceef1;
    --muted: #a0a6b1;
    --line: #3a3d44;
    --accent: #5b9bf0;
    --accent-text: #0d1117;
    --error: #f2857d;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 15px/1.45 system-ui, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ---- sign in ---- */
#login {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
#login-form {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  padding: 28px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}
h1 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.lead { margin: 2px 0 18px; color: var(--muted); }
#login-error { margin: 0 0 14px; color: var(--error); }
label { margin-bottom: 4px; font-size: 13px; color: var(--muted); }
input {
  margin-bottom: 14px;
  padding: 9px 10px;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
}
input:focus-visible, button:focus-visible, canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
canvas:focus-visible { outline: none; }
button {
  padding: 9px 14px;
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
#connect { margin-top: 6px; background: var(--accent); color: var(--accent-text); }
#connect:disabled { opacity: 0.6; cursor: default; }

/* ---- viewer ---- */
#viewer {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--stage);
  color: var(--bar-text);
}
#viewer header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: var(--bar);
  font-size: 13px;
}
#remote-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
#path {
  padding: 1px 8px;
  border: 1px solid #555;
  border-radius: 999px;
  color: #bdbdbd;
  font-size: 12px;
}
#disconnect { padding: 4px 10px; background: #444; color: var(--bar-text); font-weight: 500; }
#disconnect:hover { background: #555; }
#stage {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}
#status { margin: 0; padding: 16px; color: #c8c8c8; text-align: center; }
#screen {
  display: block;
  touch-action: none;       /* drags go to the remote program, not to page scrolling */
  cursor: default;
  user-select: none;
}
