:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  color: #f5f6fa;
  background: #080a0e;
}
* { box-sizing: border-box }
body, h1, h2, p { margin: 0 }
[hidden], p:empty { display: none !important }
button, input, textarea { font: inherit; border-radius: 12px }
button { cursor: pointer; min-height: 44px; color: inherit; background: #252a32; border: 1px solid #3b414b; padding: 9px 14px }
button:active { background: #363f4b }
:focus-visible { outline: 2px solid #80beff; outline-offset: 2px }
form { display: grid; gap: 8px }
label { font-size: 14px; font-weight: 600 }
input, textarea { min-width: 0; width: 100%; color: inherit; background: #15191f; border: 1px solid #434951; padding: 12px; font-size: 16px }
#pair {
  min-height: 100vh; min-height: 100svh; display: grid; align-content: center;
  padding: max(38px,env(safe-area-inset-top)) max(20px,env(safe-area-inset-right)) max(38px,env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left));
  background: #071627 url("/login-glass.webp") 78% center / cover no-repeat;
}
.login-stage { width: min(100%, 1024px); margin-inline: auto }
.login-brand { display: flex; align-items: center; gap: 12px; width: fit-content; margin: 0 0 24px 5px; font-size: 19px; font-weight: 650; letter-spacing: -.045em; text-shadow: 0 1px 5px #00101e }
.login-brand img { border-radius: 11px; box-shadow: 0 2px 12px #0003 }
.login-card {
  width: min(100%, 424px); padding: clamp(23px, 5.4vw, 36px); border-radius: 30px;
  color: #f7faff; background: #102336;
  border: 1px solid #91afc8; box-shadow: inset 0 1px 1px #ffffff60, inset 0 -1px 1px #9ee9ff40, 0 22px 58px #01091455;
}
@supports ((-webkit-backdrop-filter: blur(16px)) or (backdrop-filter: blur(16px))) {
  .login-card { background: linear-gradient(135deg,#50779170,#0d2038b8 47%,#1e405aa6);
    -webkit-backdrop-filter: blur(18px) saturate(135%); backdrop-filter: blur(18px) saturate(135%);
    border-color: #c4e8ff9c #c0e6ff58 #a5d9f891 #c0e6ff69 }
}
#login-title { font-size: clamp(29px, 6vw, 38px); font-weight: 680; line-height: 1.08; letter-spacing: -.052em; margin: 0 }
#login { gap: 18px }
.login-hint, #pair-instructions { color: #d2e0ed; font-size: 15px; line-height: 1.45 }
.login-hint { margin: 10px 0 3px }
#pair-instructions ol { padding-left: 1.25em; margin: 18px 0 0 }
#pair-instructions li + li { margin-top: 10px }
.login-field { display: grid; gap: 7px }
.login-field label { color: #eff7ff }
.login-field input { width: 100%; height: 50px; padding: 0 14px; background: #071421aa; border-color: #90a9c070; border-radius: 13px }
.login-field input::placeholder { color: #afbfce; opacity: 1 }
.password-wrap { position: relative }
.password-heading, .login-options { display: flex; align-items: center; justify-content: space-between; gap: 8px }
.password-heading { margin-block: -9px -6px }
#toggle-password { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; color: #d9f2ff; background: transparent; border: 0 }
.eye-slash { display: none }
#toggle-password.showing .eye-slash { display: inline }
#pin-cells { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: clamp(4px,1.2vw,8px); pointer-events: none }
#pin-cells span { display: grid; place-items: center; height: 51px; border-radius: 12px; background: #071722a6; border: 1px solid #a8cad66e; font-size: 24px; font-variant-numeric: tabular-nums }
.pin-mode .password-wrap input { position: absolute; z-index: 1; inset: 0; height: 100%; opacity: 0; cursor: text }
.pin-mode .password-wrap:focus-within .pin-active { outline: 2px solid #a3e4ff; outline-offset: 1px }
.login-options { flex-wrap: wrap; margin-block: -7px }
.login-options label, #change-mode { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; font-weight: 500; cursor: pointer }
.login-options label { gap: 8px }
#remember-user { appearance: auto; width: 17px; height: 17px; margin: 0; accent-color: #86d7fa }
#change-mode { color: #b3e4ff; border: 0; background: transparent; padding: 0 2px }
#login-submit { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 3px; min-height: 51px; border-radius: 26px; border: 1px solid #d1f4ffbf; color: #052338; background: linear-gradient(160deg,#ddfbff,#8ad9fa 70%,#a5e5ff); box-shadow: inset 0 1px 0 #ffffffc9, 0 4px 14px #00162452; font-weight: 700 }
#login-submit:active { filter: brightness(.93) }
#login-submit:disabled { cursor: progress; opacity: .82 }
#login-feedback { font-size: 14px; line-height: 1.4; color: #ffdfcc }
@media (max-width: 600px) { #pair { background-position: 80% center } .login-stage { max-width: 424px } }
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .login-card { background: #102336; border-color: #c5e7ff; -webkit-backdrop-filter: none; backdrop-filter: none }
  .login-field input { background: #071421; border-color: #a7c7dc }
}
#remote { position: fixed; inset: 0; height: 100dvh; background: #070809; display: grid; grid-template-rows: minmax(0,1fr) auto }
#screen { min-height: 0; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none }
#frame { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none }
#frame:not([src]) { visibility: hidden }
.dock { display: flex; justify-content: flex-end; padding: 2px max(10px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) 10px }
#remote.immersive .dock { position: absolute; right: 0; bottom: 0 }
#menu { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border-radius: 24px; background: #192330ee; border-color: #506075; font-weight: 600 }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none }
.glyph { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round }
#state, #error:not(:empty) { position: fixed; z-index: 1; left: 50%; top: max(12px,env(safe-area-inset-top)); transform: translateX(-50%); width: max-content; max-width: 88vw; padding: 8px 12px; border-radius: 10px; background: #20252bee; color: #eee; font-size: 14px; pointer-events: none }
#error:not(:empty) { color: #ffd3c9 }
dialog {
  position: fixed; inset: auto 0 0; width: min(100%, 500px); max-width: 100%; max-height: 92dvh;
  margin: 0 auto; padding: 0; overflow-y: auto; overscroll-behavior: contain;
  background: #17212e; color: inherit; border: 1px solid #546476; border-bottom: 0;
  border-radius: 26px 26px 0 0; box-shadow: 0 -12px 60px #04080e55;
}
@supports (backdrop-filter: blur(20px)) or (-webkit-backdrop-filter: blur(20px)) {
  dialog { background: linear-gradient(155deg, #253745f5, #121c29f5 56%); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px) }
}
dialog[open] { animation: rise .18s ease-out }
dialog::backdrop { background: #02071166 }
@keyframes rise { from { transform: translateY(100%) } }
@media (prefers-reduced-motion: reduce) { dialog[open] { animation: none } }
.sheet { padding: 16px max(18px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)) }
.sheet-head, .sheet-brand, .session-actions { display: flex; align-items: center }
.sheet-head { justify-content: space-between; margin-bottom: 15px }
.sheet-brand { gap: 11px }
.sheet-brand img { border-radius: 8px }
h2 { font-size: 22px; letter-spacing: -.035em }
#close { width: 44px; padding: 0; border-radius: 50%; background: #ffffff0f; border-color: #ffffff20 }
.control-group { margin-bottom: 16px }
.control-group h3 { margin: 0 0 7px; font-size: 13px; color: #bdcddd; font-weight: 600 }
.actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px }
.actions button { min-height: 48px; display: flex; align-items: center; gap: 8px; text-align: left; font-weight: 580; padding: 9px 12px; background: #ffffff0c; border-color: #ffffff26 }
.actions .glyph { color: #a8d8ef }
#dictate { background: #16486a; border-color: #38769b }
#dictate .glyph { color: #b0eaff }
#dictate:disabled { opacity: .7 }
button[aria-pressed=true], button[aria-expanded=true]:not(#menu) { color: #daefff; border-color: #79b5db; background: #284a68 }
.tip { color: #c2ceda; font-size: 13px; line-height: 1.42; margin: 9px 0 0 }
.gesture-help { border-top: 1px solid #ffffff20 }
.gesture-help summary { cursor: pointer; padding: 13px 0; font-size: 14px; color: #d5e3ef; min-height: 44px }
.gesture-help .tip { margin: 0 0 12px }
.session-actions { flex-wrap: wrap; justify-content: space-between; gap: 4px; border-top: 1px solid #ffffff20; padding-top: 6px }
.session-actions button { display: inline-flex; align-items: center; gap: 7px; background: transparent; border-color: transparent; padding: 8px 3px; font-size: 14px }
#logout { color: #ffbcb8 }
#sheet-error { color: #ffb8ae }
#keys { margin-top: 12px }
#shortcuts { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px }
#shortcuts button { min-width: 44px; padding-inline: 9px }
@media (orientation: landscape) and (max-height: 520px) and (min-width: 600px) {
  dialog { width: min(92vw, 740px); max-height: 96dvh }
  .sheet { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 18px }
  .sheet-head, .gesture-help, .session-actions, #sheet-error { grid-column: 1 / -1 }
}
