:root {
  --bg: #14161a;
  --bar: #1c1f26;
  --bar2: #23272f;
  --line: #2e333d;
  --fg: #e6e8ec;
  --dim: #9aa3b2;
  --accent: #4c8dff;
  --ok: #35c46b;
  --warn: #f5a623;
  --bad: #ef4c5b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow: hidden;
}

.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  z-index: 50;
}
.login form {
  width: 300px; padding: 32px;
  background: var(--bar); border: 1px solid var(--line);
  border-radius: 12px; text-align: center;
}
.login h1 { margin: 0 0 20px; font-size: 26px; letter-spacing: 2px; }
.login input, .login button {
  width: 100%; padding: 10px 12px; margin-bottom: 10px;
  border-radius: 8px; border: 1px solid var(--line);
  background: var(--bar2); color: var(--fg); font-size: 14px;
}
.login button { background: var(--accent); border: none; cursor: pointer; font-weight: 600; }
.err { color: var(--bad); min-height: 18px; margin: 4px 0 0; font-size: 12px; }

/* ---------- 布局 ---------- */
#app { display: flex; flex-direction: column; height: 100%; }

.toolbar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.toolbar button {
  min-width: 34px; height: 30px; padding: 0 9px;
  background: var(--bar2); color: var(--fg);
  border: 1px solid var(--line); border-radius: 6px;
  cursor: pointer; font-size: 14px;
}
.toolbar button:hover { background: #2c313b; }
.toolbar button.on { background: var(--accent); border-color: var(--accent); }

#url {
  flex: 1 1 240px; min-width: 160px; height: 30px;
  padding: 0 10px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--bar2); color: var(--fg);
  font-size: 13px;
}
#url:focus { outline: none; border-color: var(--accent); }

.sel { color: var(--dim); font-size: 12px; display: flex; align-items: center; gap: 4px; }
.sel select {
  height: 30px; padding: 0 6px; border-radius: 6px;
  background: var(--bar2); color: var(--fg); border: 1px solid var(--line);
  font-size: 13px;
}

.status { display: flex; align-items: center; gap: 6px; margin-left: auto; color: var(--dim); font-size: 12px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }

/* ---------- 画面 ---------- */
#stage {
  flex: 1 1 auto; position: relative; overflow: auto;
  display: flex; align-items: center; justify-content: center;
  background: #0b0c0f;
}
#stage.fit video { width: 100%; height: 100%; object-fit: contain; }
#stage.one video { width: auto; height: auto; image-rendering: auto; }

#video { display: block; background: #000; cursor: default; }

.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--dim); font-size: 14px;
  background: rgba(11,12,15,.85);
  pointer-events: none;
}

/* IME 承接框：可见但极小，保证输入法候选框能正确定位 */
.ime {
  position: fixed; left: 0; bottom: 0;
  width: 1px; height: 1px; padding: 0; margin: 0;
  border: none; outline: none; background: transparent; color: transparent;
  opacity: 0.01;
}
