:root { color-scheme: dark; --bg: #0c0f12; --bar: #161b21; --fg: #d8dde3; --dim: #8a949e; --accent: #4cc2ff; --warn: #ffb454; --bad: #ff5c5c; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
#app { display: flex; flex-direction: column; height: 100%; padding-top: env(safe-area-inset-top); }
#bar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: var(--bar); border-bottom: 1px solid #000; user-select: none; }
#brand { font-weight: 600; letter-spacing: .02em; }
#status { color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#status.warn { color: var(--warn); } #status.bad { color: var(--bad); }
#spacer { flex: 1; }
#bar button { background: #222931; color: var(--fg); border: 1px solid #30383f; border-radius: 6px; padding: 4px 10px; font-size: 16px; line-height: 1; cursor: pointer; }
#bar button:active { background: #2c353e; }
#screen-wrap { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; background: #000; overflow: hidden; touch-action: none; }
#screen { width: min(100%, calc((100vh - 40px) * 4 / 3)); aspect-ratio: 4 / 3; height: auto; max-height: 100%; image-rendering: auto; background: #000; display: block; }
#overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.6); color: var(--fg); font-size: 18px; }
#overlay[hidden] { display: none; }
#kbd-proxy { position: absolute; left: -1000px; top: 0; width: 10px; height: 10px; opacity: 0; }
#menu { background: var(--bar); border-top: 1px solid #000; padding: 8px 10px; max-height: 45vh; overflow: auto; }
#menu[hidden] { display: none; }
.menu-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; }
.menu-row.small { color: var(--dim); font-size: 12px; }
#menu button { background: #222931; color: var(--fg); border: 1px solid #30383f; border-radius: 6px; padding: 6px 12px; cursor: pointer; }
#speed { flex: 1; min-width: 160px; accent-color: var(--accent); }
#log { margin: 6px 0 0; max-height: 120px; overflow: auto; font: 12px/1.3 ui-monospace, Menlo, Consolas, monospace; color: var(--dim); white-space: pre-wrap; }
#screen-wrap.drop { outline: 3px dashed var(--accent); outline-offset: -3px; }

#oskbd { background: var(--bar); border-top: 1px solid #000; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); user-select: none; touch-action: manipulation; }
#oskbd[hidden] { display: none; }
.osk-row { display: flex; gap: 4px; margin: 3px 0; overflow-x: auto; scrollbar-width: none; }
.osk-row::-webkit-scrollbar { display: none; }
.osk-row button { flex: 0 0 auto; min-width: 38px; height: 36px; padding: 0 8px; background: #222931; color: var(--fg); border: 1px solid #30383f; border-radius: 6px; font-size: 13px; }
.osk-row button.wide { min-width: 90px; }
.osk-row button.held, .osk-row button:active { background: #3a6ea5; border-color: #4cc2ff; }
#toast { position: fixed; left: 50%; bottom: 18%; transform: translateX(-50%); background: #1e2630; color: var(--fg); border: 1px solid #30383f; border-radius: 8px; padding: 8px 14px; font-size: 13px; opacity: 0; transition: opacity .25s; pointer-events: none; max-width: 90vw; }
#toast.show { opacity: 1; }
