:root { color-scheme: light dark; --bg: #f5f5f7; --card: #fff; --border: #d2d2d7; --text: #1d1d1f; --muted: #6e6e73;
  --accent: #007aff; --danger: #d70015; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #1c1c1e; --card: #2c2c2e; --border: #3a3a3c; --text: #f5f5f7; --muted: #a1a1a6; --accent: #0a84ff; --danger: #ff453a; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font: 14px -apple-system, BlinkMacSystemFont, "PingFang TC", sans-serif; }
[hidden] { display: none !important; }
.center { position: fixed; inset: 0; display: flex; overflow: auto; padding: 20px; }
.center > .card { margin: auto; }
.card { width: min(420px, 94vw); background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 28px 30px;
  box-shadow: 0 10px 40px rgba(0,0,0,.12); display: flex; flex-direction: column; gap: 10px; }
.card.wide { width: min(580px, 94vw); }
.card p { margin: 0; line-height: 1.55; }
.logo { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 28px; color: #fff;
  background: linear-gradient(135deg, #8e44ef, #e2557a); }
.logo.warn { background: linear-gradient(135deg, #ff9f0a, #ff453a); }
h1 { font-size: 20px; margin: 4px 0 0; }
.sub { color: var(--muted); margin: 0 0 6px; font-family: "SF Mono", Menlo, monospace; font-size: 13px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
input { height: 38px; border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; font: inherit; font-size: 15px;
  background: var(--bg); color: var(--text); outline: none; }
select { height: 36px; border: 1px solid var(--border); border-radius: 10px; padding: 0 10px; font: inherit; font-size: 14px;
  background: var(--bg); color: var(--text); outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
button { font: inherit; cursor: pointer; border-radius: 10px; height: 38px; padding: 0 16px; }
button.small { height: 30px; padding: 0 12px; font-size: 13px; align-self: flex-start; }
.primary { border: none; background: var(--accent); color: #fff; font-weight: 600; }
.primary:disabled { opacity: .5; cursor: default; }
.plain { border: 1px solid var(--border); background: var(--card); color: var(--text); }
.danger { border: none; background: var(--danger); color: #fff; font-weight: 600; }
.status { min-height: 1.2em; margin: 2px 0; font-size: 13px; color: var(--muted); }
.status.err { color: var(--danger); }
.hint { color: var(--muted); font-size: 12px; margin: 0; text-align: center; }
.buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.fp { margin: 0; font-size: 12px; color: var(--muted); }
.fp code { word-break: break-all; font-size: 11px; }
/* 連線前的「顯示設定」（解析度 / 色彩 / 畫質） */
details { border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 10px; }
details[open] { padding-bottom: 4px; }
summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
summary::-webkit-details-marker { display: none; }
summary::before { content: "›"; display: inline-block; width: 10px; color: var(--muted); transition: transform .15s; }
details[open] summary::before { transform: rotate(90deg); }
#display-summary { margin-left: auto; color: var(--muted); font-size: 12px; }
details label { margin-top: 10px; }
.desc { color: var(--muted); font-size: 12.5px; }
#help-fix, #ended-fix { display: flex; flex-direction: column; gap: 8px; }
pre { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border);
  font: 12px/1.6 "SF Mono", Menlo, monospace; white-space: pre-wrap; word-break: break-all; user-select: text; }
/* 遠端畫面：照比例縮放到分頁大小 */
#screen-view { position: fixed; inset: 0; background: #000; display: grid; place-items: center; }
#screen { image-rendering: auto; cursor: default; }  /* 大小由 rdp.js 的 layoutCanvas 設 */
/* 接鍵盤 / 輸入法用的隱形輸入框，擺在畫面左上角 */
#ime { position: fixed; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; resize: none; }
#toolbar { position: fixed; top: 0; left: 50%; transform: translate(-50%, -100%); transition: transform .15s ease;
  display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 0 0 12px 12px;
  background: rgba(30,30,32,.92); color: #f5f5f7; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
#toolbar.show, #toolbar:hover { transform: translate(-50%, 0); }
#toolbar button { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; border: 1px solid #48484a; background: transparent; color: #f5f5f7; }
#toolbar button.danger { border: none; background: #ff453a; }
#info { font-size: 12px; color: #a1a1a6; padding: 0 6px; }
