:root { color-scheme: dark; font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif; background: #050b12; color: #edf5ff; --accent: #59d5ff; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body, main { width: 100%; min-height: 100%; margin: 0; }
body { overflow: hidden; background: radial-gradient(circle at 20% 10%, #16334d 0, #08131f 35%, #03070c 100%); }
button, input, select { font: inherit; }
button { min-height: 42px; border: 1px solid #62c9ee; border-radius: 8px; background: #12759a; color: white; padding: .55rem .85rem; font-weight: 700; }
button:active, button.active { transform: translateY(1px); background: #0a4d68; }
button.secondary { background: #142433; border-color: #425a6d; }
.login-panel { width: min(430px, calc(100% - 2rem)); margin: max(10vh, env(safe-area-inset-top)) auto 0; padding: 2rem; border: 1px solid #294760; border-radius: 18px; background: rgba(7, 18, 29, .94); box-shadow: 0 24px 80px #0009; }
.login-panel h1 { margin: .2rem 0 0; font: 700 clamp(2rem, 8vw, 3.2rem)/1 Georgia, serif; letter-spacing: -.04em; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; font-weight: 800; }
.edition { color: #91a9bd; font-size: .86rem; }
form { display: grid; gap: 1rem; margin-top: 2rem; }
label { display: grid; gap: .35rem; color: #b9c9d6; font-size: .82rem; }
input, select { min-height: 42px; border: 1px solid #38556d; border-radius: 7px; background: #09141e; color: #fff; padding: .5rem .65rem; }
.error { min-height: 1.2em; margin: 0; color: #ff8d8d; }
.app { height: 100dvh; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); display: grid; grid-template-rows: auto auto auto minmax(0,1fr) auto; }
header { grid-row: 1; }
.toolbar { grid-row: 2; }
.recovery { grid-row: 3; }
.viewport { grid-row: 4; }
.keybar { grid-row: 5; }
header, .toolbar, .keybar { display: flex; align-items: center; gap: .6rem; background: #07111beF; border-bottom: 1px solid #20394d; padding: .45rem .7rem; }
header { justify-content: space-between; }
.brand { font: 700 1.3rem Georgia, serif; margin-right: .6rem; }
.header-actions { display: flex; gap: .4rem; }
.session-state { display: flex; gap: .4rem; align-items: center; color: #a9bbca; }
#state-dot { width: .62rem; height: .62rem; border-radius: 50%; background: #d49a35; box-shadow: 0 0 12px #d49a35; }
#state-dot.connected { background: #4fdb8e; box-shadow: 0 0 12px #4fdb8e; }
.toolbar { overflow-x: auto; white-space: nowrap; }
.recovery { display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; background: #4b2d0d; border-bottom: 1px solid #b7792d; color: #ffe4bb; }
.recovery[hidden] { display: none; }
.toolbar label { display: flex; align-items: center; gap: .35rem; }
.toolbar select { min-width: 9rem; }
#custom-resolution { display: inline-flex; gap: .25rem; align-items: center; }
#custom-resolution input { width: 5.2rem; }
.viewport { position: relative; overflow: hidden; background: #000; touch-action: none; min-height: 0; }
#screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; transform-origin: center; }
#screen canvas { max-width: 100%; max-height: 100%; object-fit: contain; }
#disconnected { position: absolute; inset: 0; display: grid; place-content: center; gap: .4rem; text-align: center; color: #9eb0bf; background: linear-gradient(135deg,#07111b,#0d2132); }
#disconnected strong { color: #fff; }
.keybar { justify-content: center; overflow-x: auto; padding-bottom: max(.45rem, env(safe-area-inset-bottom)); }
.keybar button { min-width: 48px; background: #111f2b; border-color: #344c5f; }
.floating-controls { position: fixed; right: max(.75rem, env(safe-area-inset-right)); bottom: calc(4.4rem + env(safe-area-inset-bottom)); display: grid; gap: .55rem; z-index: 5; }
.floating-controls button { border-radius: 999px; box-shadow: 0 5px 18px #000a; }
.keyboard-capture { position: fixed; left: -200vw; bottom: 0; width: 1px; height: 1px; opacity: 0; }
@media (max-width: 760px) { header .edition { display: none; } .toolbar { font-size: .75rem; } header button, .toolbar button { min-height: 36px; padding: .4rem .55rem; } }
