:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  background: #070b14;
  color: #f7f9ff;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: radial-gradient(circle at 50% -20%, #23386d, #070b14 55%); }
button, input { font: inherit; }
select { font: inherit; }
.recent-host {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  color: #eef3ff;
  background: #080e1b;
  border: 1px solid #344361;
  border-radius: 11px;
}
.panel {
  width: min(440px, calc(100vw - 32px));
  margin: max(10vh, env(safe-area-inset-top)) auto 0;
  padding: 28px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 24px;
  background: rgba(15,22,40,.88);
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
  backdrop-filter: blur(24px);
}
.brand { color: #7da7ff; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 10px 0 8px; font-size: 30px; }
p { color: #aeb9d1; line-height: 1.55; }
label { display: block; margin: 24px 0 8px; color: #c8d2e8; font-size: 14px; }
#pin {
  width: 100%; padding: 15px; border: 1px solid #344361; border-radius: 14px;
  background: #0b1120; color: #fff; text-align: center; font-size: 28px;
  letter-spacing: .32em; outline: none;
}
#pin:focus { border-color: #6d9cff; box-shadow: 0 0 0 3px rgba(109,156,255,.18); }
button { border: 0; border-radius: 12px; padding: 12px 18px; color: #eef3ff; background: #27334c; }
button:active { transform: scale(.97); }
.primary { width: 100%; margin-top: 14px; background: #4c7fff; font-weight: 700; }
.danger { background: #612b36; }
.status { min-height: 22px; margin-top: 14px; color: #9caac5; text-align: center; }
.compliance-footer {
  position: fixed; z-index: 20; left: 50%;
  bottom: max(8px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: calc(100vw - 24px); padding: 5px 9px; border-radius: 8px;
  background: rgba(7,11,20,.72); color: #7f8da8; text-align: center;
  font-size: 12px; white-space: nowrap; backdrop-filter: blur(8px);
}
.compliance-footer[hidden] { display: none; }
.compliance-footer a { color: inherit; text-decoration: none; }
.compliance-footer a:hover, .compliance-footer a:focus {
  color: #afbdd6; text-decoration: underline;
}
#desktopPanel { width: 100%; height: 100%; background: #020306; }
header {
  position: absolute; z-index: 5; top: env(safe-area-inset-top); left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: linear-gradient(#080d19e6, transparent);
  pointer-events: none; font-size: 13px;
}
header strong { display: block; font-size: 15px; }
header span, #stats { color: #9fb0cf; }
#stats { max-width: min(72vw, 820px); text-align: right; line-height: 1.35; }
#stage {
  position: absolute; inset: 0; display: grid; place-items: center;
  overflow: hidden; touch-action: none; cursor: none; outline: none;
}
#videoViewport {
  position: absolute; inset: 0; transform-origin: 0 0; will-change: transform;
}
video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
#remoteAudio { display: none; }
#remoteCursor {
  position: absolute; z-index: 4; left: 0; top: 0; width: 14px; height: 19px;
  opacity: 0; pointer-events: none; will-change: transform;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.85));
}
#remoteCursor svg { display: block; width: 100%; height: 100%; overflow: visible; }
#remoteCursor path { fill: #fff; stroke: #111; stroke-width: 1.8; stroke-linejoin: round; }
#hint {
  position: absolute; bottom: calc(76px + env(safe-area-inset-bottom));
  padding: 8px 12px; border-radius: 999px; background: #080d19c7; color: #c5cee0;
  font-size: 12px; opacity: 1; transition: opacity .4s;
}
.camera-overlay {
  position: absolute; z-index: 7; right: 14px; bottom: calc(76px + env(safe-area-inset-bottom));
  width: min(300px, 42vw); aspect-ratio: 16 / 10; overflow: hidden;
  border: 1px solid rgba(255,255,255,.18); border-radius: 16px;
  background: #05070c; box-shadow: 0 16px 48px rgba(0,0,0,.55); cursor: default;
}
.camera-overlay.expanded { left: 3vw !important; top: 7vh !important; right: 3vw !important; bottom: 7vh !important; width: auto; aspect-ratio: auto; }
.camera-overlay img { width: 100%; height: 100%; object-fit: contain; }
.camera-title {
  position: absolute; z-index: 2; left: 0; right: 0; top: 0; display: flex;
  align-items: center; justify-content: space-between; padding: 6px 7px 18px 10px;
  background: linear-gradient(#050913dc, transparent); color: #eaf0ff; font-size: 12px;
  touch-action: none; user-select: none;
}
.camera-title > div { display: flex; gap: 4px; }
.camera-title .icon-button { width: 28px; height: 28px; font-size: 18px; background: #18233bcf; }
nav {
  position: absolute; z-index: 6; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom));
  transform: translateX(-50%); display: flex; gap: 6px; padding: 7px;
  max-width: calc(100% - 16px); overflow-x: auto; overscroll-behavior: contain;
  border: 1px solid rgba(255,255,255,.1); border-radius: 18px;
  background: rgba(11,16,29,.88); backdrop-filter: blur(18px);
  touch-action: none; user-select: none;
}
nav button { flex: 0 0 auto; white-space: nowrap; padding: 9px 11px; }
nav.vertical {
  flex-direction: column; max-width: min(132px, calc(100% - 16px));
  max-height: calc(100% - 16px); overflow-x: hidden; overflow-y: auto;
}
nav.vertical button { width: 100%; }
nav button:disabled { opacity: .42; }
.drag-handle { padding-inline: 9px; color: #8e9fbd; cursor: grab; touch-action: none; }
.drag-handle:active { cursor: grabbing; }
nav.collapsed { gap: 0; padding: 5px; overflow: visible; border-radius: 999px; }
nav.collapsed button { display: none; }
nav.collapsed .drag-handle {
  display: block; width: 44px; height: 44px; padding: 0; border-radius: 999px;
  color: #d9e5ff; background: #1c2b49;
}
.transfer-panel {
  position: absolute; z-index: 8; top: calc(54px + env(safe-area-inset-top)); right: 10px;
  width: min(420px, calc(100% - 20px)); max-height: calc(100% - 74px - env(safe-area-inset-bottom));
  overflow: auto; padding: 16px; border: 1px solid rgba(255,255,255,.14);
  border-radius: 18px; background: rgba(12,18,32,.96); box-shadow: 0 18px 60px rgba(0,0,0,.52);
  backdrop-filter: blur(22px); cursor: default;
}
.transfer-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.transfer-title strong { font-size: 17px; }
.chat-messages { display: grid; gap: 8px; min-height: 180px; max-height: min(52vh, 430px); overflow: auto; padding: 4px; }
.chat-message { padding: 9px 11px; border-radius: 11px; background: #101a2d; }
.chat-message-meta { display: flex; justify-content: space-between; gap: 8px; color: #83adff; font-size: 11px; }
.chat-message-text { margin-top: 4px; color: #e8eefb; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.chat-compose { display: flex; gap: 8px; margin-top: 10px; }
.chat-compose input { min-width: 0; flex: 1; padding: 10px 12px; border: 1px solid #344361; border-radius: 11px; outline: none; background: #080e1b; color: #eef3ff; }
.chat-compose input:focus { border-color: #6d9cff; }
.chat-compose .primary { width: auto; margin: 0; }
.icon-button { width: 34px; height: 34px; padding: 0; font-size: 24px; line-height: 1; }
.transfer-panel label { margin: 14px 0 7px; }
.transfer-panel textarea {
  display: block; width: 100%; resize: vertical; min-height: 66px; padding: 10px 12px;
  border: 1px solid #344361; border-radius: 11px; outline: none;
  background: #080e1b; color: #eef3ff; font: inherit;
}
.transfer-panel textarea:focus { border-color: #6d9cff; }
.compact { width: 100%; margin-top: 8px; padding-block: 9px; }
.file-row { display: flex; gap: 8px; align-items: center; margin-top: 9px; }
.file-row input { min-width: 0; flex: 1; color: #aeb9d1; }
.file-preview-list {
  display: grid; gap: 6px; max-height: 150px; overflow: auto; margin-top: 8px;
  padding: 7px; border: 1px solid #2c3d5d; border-radius: 10px; background: #0a1120;
}
.file-preview-empty { padding: 8px; color: #667792; text-align: center; font-size: 12px; }
.file-preview-item { display: grid; gap: 2px; padding: 7px 9px; border-radius: 8px; background: #111d32; }
.file-preview-item strong { overflow: hidden; color: #e4ebfa; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.file-preview-item span { color: #8291ad; font-size: 11px; }
.file-preview-item.invalid { border: 1px solid #8c3f4d; }
.file-preview-item.invalid span { color: #ff9eaa; }
.subtle-label { margin-top: 18px !important; color: #8291ad !important; font-size: 11px !important; }
.received-files { display: grid; gap: 7px; margin-top: 9px; }
.received-file {
  display: flex; gap: 8px; align-items: center; justify-content: space-between;
  padding: 9px 10px; border-radius: 10px; background: #101a2d; color: #cdd7eb; font-size: 13px;
}
.received-file-details { display: grid; min-width: 0; gap: 2px; }
.received-file-details strong { color: #dbe7ff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.received-file-details span { color: #8291ad; font-size: 11px; }
.received-file button { flex: none; padding: 7px 10px; border-radius: 8px; font-size: 12px; }
.pending-file-offer { border: 1px solid #476da9; background: #13213a; }
.file-offer-actions { display: flex; flex: none; gap: 6px; }
.file-offer-actions .primary { width: auto; margin: 0; }
.transfer-status { min-height: 20px; margin-top: 10px; color: #8fa1c0; font-size: 12px; }
.virtual-keyboard-panel {
  position: absolute; z-index: 9; left: 50%; bottom: calc(72px + env(safe-area-inset-bottom));
  transform: translateX(-50%); width: min(980px, calc(100% - 16px));
  max-height: min(52vh, 470px); overflow: auto; padding: 10px;
  border: 1px solid rgba(255,255,255,.16); border-radius: 18px;
  background: rgba(8,13,24,.96); box-shadow: 0 20px 70px rgba(0,0,0,.62);
  backdrop-filter: blur(22px); cursor: default; touch-action: none; user-select: none;
}
.virtual-keyboard-panel[hidden] { display: none; }
.virtual-keyboard-title {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 8px; color: #e9f0ff;
}
.virtual-keyboard-title > div:first-child { display: grid; gap: 2px; }
.virtual-keyboard-title strong { font-size: 15px; }
.virtual-keyboard-title span { color: #8291ad; font-size: 11px; }
.virtual-keyboard-actions { display: flex; align-items: center; gap: 6px; }
.virtual-keyboard-actions button:not(.icon-button) { padding: 8px 11px; white-space: nowrap; }
.virtual-keyboard-keys { display: grid; gap: 5px; }
.virtual-keyboard-row { display: flex; gap: 5px; min-width: 0; }
.virtual-key {
  flex: 1 1 0; min-width: 0; height: clamp(34px, 5.2vh, 46px); padding: 0 3px;
  border: 1px solid #334463; border-radius: 8px; background: #131e32;
  color: #ecf2ff; font-size: clamp(10px, 1.55vw, 14px); line-height: 1;
  touch-action: none; -webkit-tap-highlight-color: transparent;
}
.virtual-key:active, .virtual-key.pressed { transform: translateY(1px); background: #29497c; }
.virtual-key.modifier.active { border-color: #76a7ff; background: #24579a; color: #fff; }
.virtual-key.space-key { color: #8291ad; }
@media (max-width: 600px) {
  .virtual-keyboard-panel { bottom: calc(62px + env(safe-area-inset-bottom)); padding: 7px; border-radius: 13px; }
  .virtual-keyboard-title span { display: none; }
  .virtual-keyboard-keys, .virtual-keyboard-row { gap: 3px; }
  .virtual-key { height: clamp(31px, 5vh, 40px); padding: 0 1px; border-radius: 6px; font-size: 9px; }
  .virtual-keyboard-actions button:not(.icon-button) { padding: 7px 8px; font-size: 11px; }
}.keyboard-proxy {
  position: fixed; width: 1px; height: 1px; opacity: .01; left: 50%; bottom: 0;
}
@media (orientation: portrait) {
  nav { width: auto; max-width: calc(100% - 16px); }
  nav button { padding-inline: 9px; }
  header { padding-inline: 10px; }
  header strong { font-size: 13px; }
  #stats { font-size: 11px; }
}