:root {
  --bg: #0f1115;
  --panel: #181b22;
  --line: #2a2f3a;
  --text: #e6e8ee;
  --muted: #9aa1ae;
  --ok: #2fb36b;
  --warn: #e0a020;
  --err: #e5484d;
  --accent: #4c8dff;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; }
button, select, input { font: inherit; color: inherit; }
button { background: #232834; border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
button:hover { border-color: var(--accent); }
select { background: #232834; border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; }

/* ---------- 主界面 ---------- */
body.app { display: flex; flex-direction: column; overflow: hidden; }
.bar { display: flex; align-items: center; gap: 10px; padding: 6px 12px; background: var(--panel);
  border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.bar label { color: var(--muted); display: flex; gap: 4px; align-items: center; }
.brand { margin-right: 4px; }
.spacer { flex: 1; }
.info, .user { color: var(--muted); font-variant-numeric: tabular-nums; }
.pill { padding: 2px 10px; border-radius: 999px; font-size: 13px; border: 1px solid currentColor; white-space: nowrap; }
.pill.ok { color: var(--ok); }
.pill.warn { color: var(--warn); }
.pill.err { color: var(--err); }
.pill.idle { color: var(--muted); }
.banner { display: flex; align-items: center; gap: 12px; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.banner[hidden] { display: none; }
.banner.info { background: #16233a; }
.banner.warn { background: #3a2c10; }
.banner.err { background: #3a1517; }
.stage { position: relative; flex: 1; min-height: 0; background: #000; outline: none; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; cursor: default;
  touch-action: none; user-select: none; }
.stage.focused { box-shadow: inset 0 0 0 2px var(--accent); }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 24px; color: var(--muted); pointer-events: none; font-size: 15px; }
.overlay[hidden], .toast[hidden] { display: none; }
.toast { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); background: #2b1f22; color: #ffb4b6;
  border: 1px solid #5a2a2e; padding: 6px 12px; border-radius: 6px; pointer-events: none; }
.foot { background: var(--panel); border-top: 1px solid var(--line); }
.textbar { display: flex; gap: 8px; align-items: center; padding: 6px 12px 0; }
.textbar input[type=text] { flex: 1; min-width: 0; background: #10131a; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.textbar input[type=text]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.textbar .chk { color: var(--muted); white-space: nowrap; display: flex; gap: 4px; align-items: center; }
.hint { padding: 4px 12px 6px; color: var(--muted); font-size: 12px; }
.stage:fullscreen { box-shadow: none; }

/* ---------- 登录 ---------- */
body.login { display: flex; align-items: center; justify-content: center; padding: 16px; }
.card { width: 100%; max-width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.card h1 { margin: 0 0 4px; font-size: 20px; }
.card label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); }
.card input { background: #10131a; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.card input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.card button { background: var(--accent); border-color: var(--accent); color: #fff; padding: 8px; }
.card button:disabled { opacity: .6; }
.msg { margin: 0; padding: 8px 10px; background: #3a1517; border: 1px solid #5a2a2e; border-radius: 6px; color: #ffb4b6; }
.msg[hidden] { display: none; }
