:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #202737;
  background: #f3f6f9;
  font-synthesis: none;
  --blue: #3478f6;
  --blue-hover: #2465db;
  --muted: #647185;
  --line: #e8edf3;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 24px; }
body { margin: 0; font-size: 13px; line-height: 1.5; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; border: 0; border-radius: 8px; transition: background .15s; }
button:disabled { opacity: .42; cursor: default; }
input, textarea, select { width: 100%; background: #f8fafc; border: 1px solid #e0e6ef; border-radius: 7px; padding: 10px 12px; color: #202737; min-height: 40px; }
input:focus, textarea:focus, select:focus { outline: 2px solid #3478f633; outline-offset: 1px; border-color: var(--blue); }
input::placeholder, textarea::placeholder { color: #7e8a9c; }
textarea { resize: vertical; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 23px; font-weight: 650; margin-bottom: 4px; }
h2 { font-size: 17px; font-weight: 600; margin-bottom: 0; }
h3 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.app-shell { display: grid; grid-template-columns: 190px minmax(0, 1fr); height: 100dvh; }
.navigation { position: sticky; top: 0; height: 100dvh; background: #edf2f7; border-right: 1px solid #e2e8f0; padding: 28px 14px 22px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 0 8px 28px; white-space: nowrap; }
.brand strong { font-size: 17px; font-weight: 650; }
.brand-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: var(--blue); color: white; }
.brand-icon .icon { width: 24px; height: 24px; }
.nav-caption { font-size: 11px; color: #758297; padding: 6px 12px 12px; }
.navigation nav { display: grid; gap: 7px; }
.rail-link { display: flex; width: 100%; align-items: center; gap: 11px; min-height: 48px; padding: 11px 12px; border-radius: 10px; text-align: left; background: transparent; color: #566176; white-space: nowrap; }
.rail-link:hover { background: #e4ebf5; color: #202737; }
.rail-link[aria-current="page"] { color: #2569e6; background: #e0eaff; font-weight: 600; }
.nav-footer { margin-top: auto; border-top: 1px solid #dce4ed; padding: 19px 9px 0; display: flex; gap: 9px; color: #6e7d92; font-size: 12px; }
.nav-footer .icon { color: #6587b7; margin-top: 3px; }
.nav-footer small { font-size: 11px; color: #8895a7; }
.app-content { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.topbar { padding: 27px 28px 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.page-title p { color: var(--muted); font-size: 12px; margin: 0; }
.header-actions { display: flex; align-items: center; gap: 12px; min-width: 0; }
.session-pill { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 20px; background: #e9eef4; color: #647185; font-size: 12px; min-width: 0; }
.session-pill span { overflow-wrap: anywhere; }
.session-pill i { width: 6px; height: 6px; flex: 0 0 auto; background: #8794a7; border-radius: 50%; }
.session-pill i.online { background: #27ae70; }
.settings-button { display: block; }
main { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; flex: 1; min-height: 0; overflow-y: auto; padding: 0 28px 12px; }
.sidebar, .controls { width: 100%; max-width: 700px; justify-self: center; }
body[data-page="remote"] main { align-items: stretch; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; min-width: 0; scroll-margin-top: 24px; }
.sidebar, .controls { padding: 22px 20px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.eyebrow { display: block; color: #738198; font-size: 11px; margin-bottom: 5px; }
.section-icon { color: #a3b3c8; width: 26px; height: 26px; }
.muted { color: var(--muted); font-size: 12px; line-height: 1.8; margin: 11px 0 18px; }
.device-card { display: flex; align-items: center; gap: 10px; padding: 14px 12px; background: #f0f5fe; border: 1px solid #e0eaff; border-radius: 9px; margin: 0 0 19px; }
.phone-icon { display: grid; place-items: center; flex: 0 0 auto; width: 37px; height: 45px; border-radius: 8px; color: var(--blue); background: #dfeaff; }
.phone-icon .icon { width: 26px; height: 29px; }
.device-copy { flex: 1; min-width: 0; }
.device-card strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.device-card p { margin: 4px 0 0; font-size: 11px; color: #697c97; overflow-wrap: anywhere; }
.badge { flex: 0 0 auto; font-size: 9px; letter-spacing: .3px; padding: 3px 5px; border-radius: 4px; color: #5681bd; background: #e2ebfb; align-self: flex-start; }
label { display: block; color: #566176; font-size: 12px; margin: 13px 0 7px; }
.secret-input { position: relative; }
.secret-input input { padding-right: 43px; }
.secret-input button { position: absolute; right: 2px; top: 2px; width: 38px; height: 36px; background: transparent; color: #74849b; }
.icon-button { display: inline-grid; place-items: center; padding: 8px; min-width: 36px; min-height: 36px; background: #eef3fa; color: #617791; }
.icon-button:hover { background: #e2ebf7; }
.check { display: flex; align-items: center; gap: 8px; font-size: 11px; line-height: 1.6; margin: 14px 0 0; }
.check input { width: 15px; height: 15px; min-height: 0; margin: 0; accent-color: var(--blue); flex: 0 0 auto; }
.primary { background: var(--blue); color: #fff; padding: 11px 16px; font-weight: 600; }
.primary:hover { background: var(--blue-hover); }
.secondary { background: #f4f7fc; border: 1px solid #dfe7f1; padding: 10px 13px; color: #43618a; }
.secondary:hover { background: #e9f0fb; }
.wide { width: 100%; margin-top: 14px; }
.primary.wide { display: flex; align-items: center; justify-content: center; gap: 12px; }
.primary .icon { width: 17px; height: 17px; }
.link { background: transparent; color: #366fc3; padding: 6px 2px; font-size: 11px; }
.link:hover { color: #174fa8; background: #f0f5fd; }
.pair-tools { display: flex; align-items: center; justify-content: space-between; gap: 5px; margin-top: 11px; }
.advanced { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); color: #68778d; font-size: 12px; }
.advanced summary { cursor: pointer; padding: 4px 0; }
.advanced .link { margin-top: 9px; text-align: left; }
.security-note { display: flex; align-items: flex-start; gap: 8px; color: #77879b; font-size: 11px; line-height: 1.8; margin-top: 22px; }
.security-note .icon { width: 16px; height: 16px; color: #6388c1; margin-top: 3px; }
.security-note p { margin: 0; }
.workspace { display: flex; flex-direction: column; padding: 18px; height: 100%; min-height: 300px; }
.workspace-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 16px; }
.screen-status { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; color: #768398; font-size: 11px; min-width: 0; }
#control-mode { color: #2868c7; background: #ecf3ff; padding: 3px 7px; border-radius: 4px; white-space: nowrap; }
.viewer { display: flex; align-items: center; justify-content: center; flex: 1; min-height: 120px; border-radius: 9px; background: #eef3f9; overflow: hidden; position: relative; }
.screen-wrap { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; min-height: 0; }
.viewer:has(canvas:not([hidden])) { background: #101721; }
.viewer canvas { max-height: 100%; max-width: 100%; width: auto; height: auto; object-fit: contain; touch-action: none; user-select: none; cursor: crosshair; }
.empty { text-align: center; padding: 32px 16px; }
.empty-phone { width: 74px; height: 128px; border: 2px solid #afc5e3; border-radius: 17px; background: #e1ebfa; margin: 0 auto 24px; transform: rotate(-7deg); position: relative; box-shadow: 10px 10px 0 #dbe6f5; }
.empty-phone span { display: block; width: 24px; height: 4px; margin: 10px auto 22px; border-radius: 3px; background: #afc5e3; }
.empty-phone .icon { width: 33px; height: 33px; color: #6d99d3; }
.empty h3 { color: #405778; font-size: 15px; font-weight: 500; margin: 0 0 9px; }
.empty p { color: #7c8da5; font-size: 12px; line-height: 1.9; margin: 0; }
.encrypted-label { display: inline-flex; align-items: center; gap: 5px; margin-top: 23px; color: #6d8db4; font-size: 11px; }
.encrypted-label .icon { width: 14px; height: 14px; }
.remote-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.nav-buttons { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.nav-buttons button { background: #f0f4fa; color: #5a6e8a; padding: 7px 9px; min-width: 32px; min-height: 32px; font-size: 11px; }
.nav-buttons button:nth-child(-n+3) { font-size: 21px; line-height: 1; padding: 4px 8px; }
.separator { height: 20px; width: 1px; background: #dce4ee; margin: 0 4px; }
.capture-buttons { display: flex; gap: 9px; }
.stats { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 12px; font-size: 10px; padding-top: 12px; color: #8190a5; }
.stats b { font-weight: 400; color: #677c99; }
.stats i { display: inline-block; width: 5px; height: 5px; background: #7594bc; border-radius: 50%; margin-right: 5px; }
#transport { font-size: 9px; }
.controls h2 { margin-bottom: 12px; }
.controls label { margin-top: 14px; }
.hint { color: #738298; font-size: 11px; line-height: 1.8; margin: 10px 0; overflow-wrap: anywhere; }
.divider { border-top: 1px solid var(--line); margin: 23px 0 19px; }
.controls textarea { font-size: 12px; }
.controls dl { margin: 14px 0; font-size: 11px; }
.controls dl div { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.controls dt { color: #7c8ba0; }
.controls dd { color: #4e6688; margin: 0; text-align: right; overflow-wrap: anywhere; }
.notice { padding: 12px; background: #f1f6ff; border: 1px solid #e2ebfa; border-radius: 8px; font-size: 11px; color: #597aa5; line-height: 1.8; margin-top: 20px; overflow-wrap: anywhere; }
.notice.error { background: #fff3f2; border-color: #f0d2cd; color: #af4c40; }
.app-notice { margin: 0 28px 12px; padding: 8px 12px; }
.page-footer { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 21px; font-size: 11px; color: #94a1b2; }
.page-footer .icon { width: 13px; height: 13px; }
dialog { border: 1px solid #e0e8f1; border-radius: 14px; width: 440px; max-width: calc(100vw - 28px); background: #fff; color: #202737; padding: 26px; box-shadow: 0 24px 90px #1d335c33; }
dialog::backdrop { background: #1a2a4655; backdrop-filter: blur(3px); }
dialog p { color: #738298; font-size: 12px; line-height: 1.8; margin: 13px 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
#mobile-disconnect { display: none; }
.workspace.expanded, .workspace:fullscreen { position: fixed; inset: 0; z-index: 30; margin: 0; border: 0; border-radius: 0; background: #f3f6f9; padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
.workspace.expanded .viewer, .workspace:fullscreen .viewer { flex: 1; height: auto; min-height: 0; max-height: none; }
.workspace.expanded canvas, .workspace:fullscreen canvas { max-height: calc(100dvh - 185px); }
@media (max-width: 900px) {
  body { font-size: 14px; }
  .app-shell { display: block; height: 100dvh; }
  .app-content { height: 100%; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .navigation { position: fixed; top: auto; bottom: 0; left: 0; width: 100%; height: auto; z-index: 20; padding: 5px max(8px, env(safe-area-inset-right)) max(7px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); background: #ffffffed; backdrop-filter: blur(10px); border: 0; border-top: 1px solid #e3eaf3; }
  .navigation .brand, .nav-caption, .nav-footer { display: none; }
  .navigation nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .rail-link { flex-direction: column; justify-content: center; gap: 4px; padding: 7px 4px; min-height: 53px; font-size: 11px; border-radius: 8px; text-align: center; }
  .rail-link[aria-current="page"] { background: transparent; }
  .topbar { padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left)); align-items: flex-start; gap: 8px; }
  h1 { font-size: 24px; font-weight: 700; }
  .page-title p { font-size: 11px; }
  .header-actions { align-items: flex-end; flex-direction: column; gap: 6px; max-width: 52%; }
  .settings-button { padding: 6px 10px; min-height: 36px; font-size: 12px; }
  .session-pill { font-size: 11px; padding: 4px 9px; }
  main { padding: 0 max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left)); }
  .panel { border-radius: 16px; }
  .sidebar, .controls { padding: 20px 18px; }
  .workspace { padding: 14px 12px; min-height: 340px; }
  .workspace-heading { margin-bottom: 12px; align-items: flex-start; }
  .workspace-heading h2 { font-size: 16px; }
  .screen-status { max-width: 65%; gap: 5px; }
  #lock-state { max-width: 100%; font-size: 10px; }
  #mobile-disconnect { display: inline-block; min-height: 36px; padding: 6px; }
  .empty { padding: 12px; }
  .empty-phone { width: 52px; height: 88px; margin-bottom: 15px; }
  .empty-phone span { margin-bottom: 14px; }
  .empty h3 { font-size: 14px; }
  .encrypted-label { margin-top: 12px; }
  .remote-toolbar { background: #fff; padding: 10px 0; gap: 8px; }
  .nav-buttons { width: 100%; gap: 5px; }
  .nav-buttons button { flex: 1; min-width: 36px; min-height: 40px; padding-inline: 4px; font-size: 12px; }
  .separator { display: none; }
  .capture-buttons { width: 100%; gap: 8px; }
  .capture-buttons .link { flex: 1; min-height: 40px; background: #f4f7fc; border: 1px solid #e2eaf5; border-radius: 7px; text-align: center; }
  .stats { font-size: 10px; gap: 4px 10px; padding-top: 8px; }
  #transport { display: none; }
  input, textarea, select { font-size: 16px; }
  .controls textarea { font-size: 16px; }
  .link, .pair-tools button, .secondary, .primary, .icon-button { min-height: 44px; }
  .secret-input button { height: calc(100% - 4px); min-height: 0; width: 42px; }
  .pair-tools { flex-wrap: wrap; }
  .check { min-height: 35px; font-size: 12px; }
  .check input { width: 18px; height: 18px; }
  .hint { font-size: 12px; }
  .app-notice { margin: 0 12px 8px; padding: 6px 10px; font-size: 11px; }
  .page-footer { display: none; }
  dialog { padding: 22px; }
}
@media (max-height: 500px) and (max-width: 900px) {
  .topbar { padding-top: 8px; padding-bottom: 8px; }
  .page-title p, .settings-button { display: none; }
  .header-actions { justify-content: center; }
  .workspace { min-height: 340px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto; transition: none; } }
