:root {
  --bg: #0f1115;
  --panel: #171a21;
  --line: #262b36;
  --fg: #e6e9ef;
  --dim: #8b93a7;
  --acc: #4c8dff;
  --ok: #35c98a;
  --warn: #ffb020;
  --err: #ff5c5c;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--fg);
  font: 13px/1.5 -apple-system, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  overflow: hidden;
}
#app { display: flex; flex-direction: column; height: 100vh; }

#bar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; background: var(--panel);
  border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.brand { font-weight: 700; letter-spacing: .5px; }
.brand span { color: var(--dim); font-weight: 400; margin-left: 4px; }
.group { display: flex; align-items: center; gap: 6px; }
#status { margin-left: auto; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
#status.on { color: var(--ok); }
#status.warn { color: var(--warn); }
#status.err { color: var(--err); }

button {
  background: #222835; color: var(--fg); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 12px; cursor: pointer; font: inherit;
}
button:hover:not(:disabled) { border-color: var(--acc); color: #fff; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--acc); border-color: var(--acc); color: #fff; }
select, input {
  background: #11141a; color: var(--fg); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 8px; font: inherit; outline: none;
}
select:focus, input:focus { border-color: var(--acc); }

#login {
  margin: 60px auto; width: 340px; padding: 22px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
}
#login h2 { margin: 0 0 6px; font-size: 16px; }
#login label { display: flex; align-items: center; justify-content: space-between; margin: 10px 0; color: var(--dim); }
#login input { width: 190px; }
#login button { width: 100%; margin-top: 10px; padding: 8px; }
.hint { color: var(--dim); font-size: 12px; margin: 0 0 6px; }
.msg { margin-top: 10px; font-size: 12px; min-height: 16px; }
.msg.err { color: var(--err); }
.msg.ok { color: var(--ok); }
.chk { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--dim); font-size: 12px; }

#home {
  flex: 1 1 auto; min-height: 0; overflow: auto;
  padding: 28px 32px 40px; max-width: 720px; margin: 0 auto; width: 100%;
}
.home-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 4px;
}
.home-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.device-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.device-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); cursor: pointer; text-align: left; width: 100%;
  color: inherit; font: inherit;
}
.device-card:hover:not(:disabled) { border-color: var(--acc); }
.device-card:disabled { opacity: .55; cursor: not-allowed; }
.device-card .dot {
  width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto;
  background: var(--dim);
}
.device-card.ready .dot { background: var(--ok); }
.device-card.busy .dot { background: var(--warn); }
.device-card .meta { flex: 1 1 auto; min-width: 0; }
.device-card .name { font-weight: 600; font-size: 14px; }
.device-card .sub { color: var(--dim); font-size: 12px; margin-top: 2px; }
.device-card .action {
  flex: 0 0 auto; color: var(--acc); font-size: 13px; font-weight: 600;
}
.device-empty {
  padding: 28px 16px; text-align: center; color: var(--dim);
  border: 1px dashed var(--line); border-radius: 10px;
}

#stage {
  position: relative; flex: 1 1 auto; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  background: #000; overflow: hidden;
  /* 整块舞台都隐藏本地光标，避免漏出默认箭头 / 旧版 crosshair「+」 */
  cursor: none;
}
#screen {
  max-width: 100%; max-height: 100%;
  image-rendering: auto; outline: none;
  /* 不要 crosshair：会在画面上叠一个「+」，再加 gdigrab 画进去的系统鼠标 = 双光标 */
  cursor: none !important;
  background: #000;
}
.overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  background: rgba(10, 12, 16, .72); color: var(--fg); pointer-events: none;
}
.overlay.hide { display: none; }
.overlay .sub { color: var(--dim); font-size: 12px; }
.overlay code { background: #11141a; padding: 2px 6px; border-radius: 4px; }

#panel {
  position: absolute; top: 48px; right: 8px; width: 236px;
  background: rgba(23, 26, 33, .94); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px; font-size: 12px;
}
#panel .row { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
#panel .row b { color: var(--dim); font-weight: 500; }
#panel hr { border: none; border-top: 1px solid var(--line); margin: 8px 0; }
#panel label { display: flex; gap: 6px; align-items: center; color: var(--fg); }
.log {
  max-height: 120px; overflow: auto; color: var(--dim);
  font-family: ui-monospace, Consolas, monospace; font-size: 11px;
  white-space: pre-wrap; word-break: break-all;
}
@media (max-width: 720px) {
  #bar { flex-wrap: wrap; gap: 6px; }
  #panel { display: none; }
}

/* 当前账号区 + 记住登录 */
#whoami { gap: 6px; align-items: center; color: #9fb3c8; font-size: 12px; }
#whoami span { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
label.chk { display: flex; align-items: center; gap: 6px; color: #9aa7b8; font-size: 12px; }
label.chk input { width: auto; }
