:root {
  color-scheme: dark;
  font-family:
    "Microsoft YaHei UI", "PingFang SC", system-ui, -apple-system, sans-serif;
  background: #030811;
  color: #f8fafc;
  font-synthesis: none;
  -webkit-tap-highlight-color: transparent;
}

/* Multi-host thumbnail tray. Landscape reserves a right rail; portrait
   reserves a bottom deck so the controlled desktop keeps the largest axis. */
:root {
  --thumbnail-panel-width: clamp(230px, 32vw, 330px);
  --thumbnail-panel-height: clamp(250px, 38vh, 340px);
}

.thumbnail-panel {
  position: relative;
  z-index: 18;
  display: flex;
  width: var(--thumbnail-panel-width);
  height: 100%;
  min-width: 0;
  min-height: 0;
  flex: 0 0 var(--thumbnail-panel-width);
  flex-direction: column;
  border-left: 1px solid rgba(105, 146, 202, 0.22);
  background:
    radial-gradient(circle at 50% 0%, rgba(30, 103, 204, 0.13), transparent 34%),
    #07111f;
  box-shadow: -16px 0 40px rgba(0, 0, 0, 0.24);
}

.thumbnail-panel[aria-hidden="true"] {
  display: none;
}

.thumbnail-panel-header {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid rgba(110, 150, 204, 0.18);
  padding: 8px 9px 8px 11px;
}

.thumbnail-panel-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 1px solid rgba(87, 156, 255, 0.36);
  border-radius: 11px;
  background: rgba(15, 107, 255, 0.14);
  color: #78b3ff;
}

.thumbnail-panel-mark svg,
.thumbnail-panel-close svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.thumbnail-panel-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.thumbnail-panel-copy strong {
  color: #eff6ff;
  font-size: 12px;
  font-weight: 760;
}

.thumbnail-panel-copy small {
  color: #7890ad;
  font-size: 9px;
}

.thumbnail-panel-close {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: rgba(120, 153, 198, 0.08);
  color: #8298b4;
}

.thumbnail-panel-close:active {
  background: rgba(120, 153, 198, 0.18);
  color: #fff;
}

.thumbnail-grid {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 8px;
  overflow: auto;
  padding: 9px;
  overscroll-behavior: contain;
}

.thumbnail-card {
  position: relative;
  display: flex;
  min-width: 0;
  aspect-ratio: 16 / 11;
  overflow: hidden;
  border: 1px solid rgba(117, 153, 201, 0.28);
  border-radius: 10px;
  background: #020711;
  color: #dce9f8;
  padding: 0;
  text-align: left;
}

.thumbnail-card::before {
  position: absolute;
  z-index: 0;
  inset: 0;
  content: "";
  background:
    linear-gradient(110deg, transparent 28%, rgba(83, 143, 220, 0.11) 45%, transparent 62%),
    radial-gradient(circle at 70% 24%, rgba(21, 106, 227, 0.2), transparent 48%);
  background-size: 220% 100%, 100% 100%;
  animation: thumbnail-waiting 2.4s linear infinite;
}

@keyframes thumbnail-waiting {
  to {
    background-position: -220% 0, 0 0;
  }
}

.thumbnail-card canvas {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: transparent;
}

.thumbnail-card-footer {
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  min-height: 28px;
  align-items: center;
  gap: 5px;
  background: linear-gradient(180deg, transparent, rgba(2, 8, 18, 0.94));
  padding: 8px 7px 4px;
}

.thumbnail-card-footer i {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: #f0b94e;
  box-shadow: 0 0 0 3px rgba(240, 185, 78, 0.12);
}

.thumbnail-card.is-online .thumbnail-card-footer i {
  background: #36d39a;
  box-shadow: 0 0 0 3px rgba(54, 211, 154, 0.12);
}

.thumbnail-card.is-offline .thumbnail-card-footer i {
  background: #ff7373;
  box-shadow: 0 0 0 3px rgba(255, 115, 115, 0.12);
}

.thumbnail-card-footer strong {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: #edf6ff;
  font-size: 9px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thumbnail-card.is-active {
  border-color: #4d9aff;
  box-shadow:
    0 0 0 2px rgba(15, 107, 255, 0.2),
    0 10px 24px rgba(0, 0, 0, 0.3);
}

.thumbnail-card.is-active::after {
  position: absolute;
  z-index: 4;
  top: 6px;
  left: 6px;
  content: "当前控制";
  border: 1px solid rgba(147, 203, 255, 0.6);
  border-radius: 999px;
  background: rgba(15, 107, 255, 0.88);
  color: #fff;
  font-size: 8px;
  font-weight: 760;
  padding: 3px 6px;
}

body.is-thumbnails-open .session-controls {
  right: calc(var(--thumbnail-panel-width) + max(14px, env(safe-area-inset-right)));
}

.floating-control > .control-icon--thumbnails {
  width: 27px;
  height: 27px;
}

.floating-control[hidden] {
  display: none !important;
}

@media (orientation: portrait) {
  .remote-shell {
    flex-direction: column;
  }

  .thumbnail-panel {
    width: 100%;
    height: var(--thumbnail-panel-height);
    flex-basis: var(--thumbnail-panel-height);
    border-top: 1px solid rgba(105, 146, 202, 0.22);
    border-left: 0;
    box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.24);
  }

  .thumbnail-panel-header {
    min-height: 52px;
  }

  .thumbnail-grid {
    grid-auto-columns: minmax(148px, 44vw);
    grid-auto-flow: column;
    grid-template-columns: none;
    grid-template-rows: 1fr;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .thumbnail-card {
    height: 100%;
    max-height: 190px;
    aspect-ratio: 16 / 10;
  }

  body.is-thumbnails-open .session-controls {
    right: max(14px, calc(env(safe-area-inset-right) + 10px));
    bottom: calc(var(--thumbnail-panel-height) + max(12px, env(safe-area-inset-bottom)));
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #030811;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid #6ba8ff;
  outline-offset: 2px;
}

.remote-shell {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.remote-screen {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, rgba(19, 52, 88, 0.18), transparent 45%),
    #030811;
}

.remote-screen.is-original-fit {
  align-items: flex-start;
  justify-content: flex-start;
  overflow: auto;
}

.remote-canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  background: #02050a;
  outline: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.remote-screen.is-original-fit .remote-canvas {
  max-width: none;
  max-height: none;
}

.remote-cursor-indicator {
  position: fixed;
  z-index: 22;
  top: 0;
  left: 0;
  display: grid;
  width: 24px;
  height: 30px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(-48px, -48px, 0);
  transform-origin: 0 0;
  transition:
    opacity 120ms ease,
    visibility 120ms;
  will-change: transform;
}

.remote-cursor-indicator.is-visible {
  visibility: visible;
  opacity: 1;
}

.remote-cursor-shape,
.remote-cursor-fallback {
  grid-area: 1 / 1;
}

.remote-cursor-shape {
  display: none;
  width: 100%;
  height: 100%;
  image-rendering: auto;
}

.remote-cursor-indicator.has-remote-shape .remote-cursor-shape {
  display: block;
}

.remote-cursor-indicator.has-remote-shape .remote-cursor-fallback {
  display: none;
}

.remote-cursor-fallback {
  display: block;
  width: 24px;
  height: 30px;
  overflow: visible;
  fill: #ffffff;
  stroke: #000000;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
  filter: drop-shadow(1px 2px 1px rgba(0, 0, 0, 0.58));
}

.state-panel {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background:
    radial-gradient(circle at 50% 40%, rgba(15, 107, 255, 0.14), transparent 38%),
    rgba(3, 8, 17, 0.93);
  padding: 28px;
  text-align: center;
}

.state-panel[hidden],
.state-spinner[hidden] {
  display: none;
}

.state-panel strong {
  margin-top: 14px;
  font-size: 18px;
  letter-spacing: -0.2px;
}

.state-panel p {
  max-width: 440px;
  margin: 8px 0 0;
  color: #91a5c2;
  font-size: 12px;
  line-height: 19px;
}

.state-action {
  min-height: 42px;
  margin-top: 20px;
  border: 1px solid #3e8dff;
  border-radius: 11px;
  background: #0f6bff;
  color: #fff;
  font-size: 12px;
  font-weight: 750;
  padding: 0 22px;
}

.state-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(97, 146, 216, 0.22);
  border-top-color: #4f9bff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.session-controls {
  position: fixed;
  z-index: 24;
  right: max(14px, calc(env(safe-area-inset-right) + 10px));
  bottom: max(16px, calc(env(safe-area-inset-bottom) + 10px));
  display: flex;
  visibility: hidden;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    visibility 160ms;
}

.session-controls.is-visible {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

body.is-sheet-open .session-controls {
  visibility: hidden;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.floating-control {
  position: relative;
  display: flex;
  width: 52px;
  height: 52px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(153, 184, 225, 0.28);
  border-radius: 16px;
  background: rgba(11, 24, 42, 0.9);
  color: #edf5ff;
  box-shadow:
    0 12px 34px rgba(0, 0, 0, 0.38),
    inset 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(18px);
  cursor: pointer;
  touch-action: manipulation;
}

.floating-control:active {
  transform: scale(0.95);
}

.floating-control.is-active {
  border-color: rgba(95, 160, 255, 0.72);
  background: rgba(22, 84, 168, 0.92);
  color: #fff;
  box-shadow:
    0 12px 34px rgba(0, 0, 0, 0.38),
    0 0 0 3px rgba(50, 132, 241, 0.13),
    inset 0 1px rgba(255, 255, 255, 0.1);
}

.floating-control:disabled {
  color: #60738d;
  opacity: 0.62;
}

.floating-control > .control-icon {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.floating-control > .control-icon--pointer {
  width: 28px;
  height: 28px;
}

.floating-control .control-icon-fill {
  fill: currentColor;
  stroke: none;
}

.floating-control > .control-icon--settings {
  width: 26px;
  height: 26px;
  stroke-width: 1.5;
}

.virtual-mouse-panel {
  position: fixed;
  z-index: 23;
  left: calc(50% - 48px);
  bottom: max(16px, calc(env(safe-area-inset-bottom) + 10px));
  width: min(246px, calc(100vw - 28px));
  visibility: hidden;
  border: 1px solid rgba(156, 188, 229, 0.3);
  border-radius: 23px;
  background:
    radial-gradient(circle at 50% 100%, rgba(35, 111, 216, 0.16), transparent 44%),
    rgba(7, 17, 31, 0.94);
  color: #eef6ff;
  opacity: 0;
  padding: 9px;
  transform: translateY(12px) scale(0.96);
  transform-origin: center bottom;
  box-shadow:
    0 22px 54px rgba(0, 0, 0, 0.48),
    inset 0 1px rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(22px);
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    visibility 160ms;
}

.virtual-mouse-panel.is-open {
  visibility: visible;
  opacity: 1;
  transform: translateY(0) scale(1);
}

.virtual-mouse-panel.is-moving {
  transition: none;
  box-shadow:
    0 28px 64px rgba(0, 0, 0, 0.55),
    0 0 0 2px rgba(67, 147, 255, 0.15),
    inset 0 1px rgba(255, 255, 255, 0.09);
}

body.is-sheet-open .virtual-mouse-panel {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.98);
}

.virtual-mouse-header {
  display: flex;
  height: 30px;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 6px 7px;
}

.virtual-mouse-header > span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #b8c8dc;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.2px;
}

.virtual-mouse-header > span i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #52a2ff;
  box-shadow: 0 0 0 4px rgba(82, 162, 255, 0.12);
}

.virtual-mouse-header button {
  display: flex;
  width: 26px;
  height: 26px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #8296b0;
  padding: 0;
}

.virtual-mouse-header button:active {
  background: rgba(132, 161, 198, 0.14);
  color: #fff;
}

.virtual-mouse-header svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.7;
}

.virtual-mouse-body {
  position: relative;
  display: grid;
  overflow: hidden;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: 43px 82px;
  border: 1px solid rgba(142, 176, 220, 0.22);
  border-radius: 22px 22px 34px 34px;
  background:
    linear-gradient(90deg, transparent calc(50% - 0.5px), rgba(143, 174, 215, 0.17) 50%, transparent calc(50% + 0.5px)),
    linear-gradient(180deg, rgba(24, 45, 72, 0.98), rgba(11, 27, 48, 0.98));
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.06),
    inset 0 -18px 30px rgba(0, 0, 0, 0.14);
}

.virtual-mouse-key {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-bottom: 1px solid rgba(144, 176, 218, 0.18);
  background: rgba(22, 43, 70, 0.54);
  color: #c8d6e8;
  font-size: 9px;
  font-weight: 750;
  padding: 0 12px;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.virtual-mouse-key.is-left {
  justify-content: flex-start;
  border-right: 1px solid rgba(144, 176, 218, 0.13);
  border-radius: 21px 0 0;
}

.virtual-mouse-key.is-right {
  justify-content: flex-end;
  border-radius: 0 21px 0 0;
}

.virtual-mouse-key svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #7fa9df;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.virtual-mouse-key.is-active {
  background: rgba(38, 117, 225, 0.44);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(102, 169, 255, 0.35);
}

.virtual-mouse-trackpad {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  grid-column: 1 / -1;
  flex-direction: column;
  gap: 2px;
  color: #9fb2ca;
  padding: 12px 42px 7px;
  text-align: center;
  touch-action: none;
  user-select: none;
  cursor: grab;
}

.virtual-mouse-trackpad svg {
  width: 19px;
  height: 19px;
  margin-bottom: 2px;
  fill: rgba(114, 170, 245, 0.16);
  stroke: #72aaf5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.virtual-mouse-trackpad span {
  font-size: 9px;
  font-weight: 750;
}

.virtual-mouse-trackpad small {
  color: #6f86a3;
  font-size: 7px;
  line-height: 10px;
}

.virtual-mouse-trackpad.is-active {
  background: radial-gradient(circle at 50% 50%, rgba(52, 126, 228, 0.18), transparent 62%);
  cursor: grabbing;
}

.virtual-mouse-wheel-stack {
  position: absolute;
  z-index: 2;
  top: 6px;
  left: 50%;
  display: grid;
  width: 36px;
  grid-template-rows: 28px 50px 28px;
  gap: 2px;
  transform: translateX(-50%);
}

.virtual-mouse-scroll-button {
  display: flex;
  width: 36px;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(119, 166, 226, 0.34);
  background:
    linear-gradient(180deg, rgba(19, 37, 60, 0.98), rgba(7, 18, 33, 0.98));
  color: #77aaf0;
  padding: 0;
  touch-action: manipulation;
  user-select: none;
}

.virtual-mouse-scroll-button.is-up {
  border-radius: 14px 14px 8px 8px;
}

.virtual-mouse-scroll-button.is-down {
  border-radius: 8px 8px 14px 14px;
}

.virtual-mouse-scroll-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.virtual-mouse-scroll-button:active {
  border-color: rgba(112, 174, 255, 0.86);
  background: #1257ad;
  color: #fff;
  transform: scale(0.94);
}

.virtual-mouse-wheel {
  position: relative;
  display: flex;
  width: 36px;
  height: 50px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(119, 166, 226, 0.34);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(19, 37, 60, 0.98), rgba(7, 18, 33, 0.98));
  color: #77aaf0;
  box-shadow:
    0 6px 17px rgba(0, 0, 0, 0.34),
    inset 0 1px rgba(255, 255, 255, 0.07);
  touch-action: none;
  user-select: none;
}

.virtual-mouse-wheel i {
  position: absolute;
  top: 50%;
  width: 11px;
  height: 3px;
  border-radius: 2px;
  background: #83b7ff;
  transform: translateY(-50%);
  box-shadow:
    0 -5px rgba(131, 183, 255, 0.38),
    0 5px rgba(131, 183, 255, 0.38);
}

.virtual-mouse-wheel.is-active {
  border-color: rgba(112, 174, 255, 0.78);
  background: #0b356d;
  color: #fff;
}

.virtual-mouse-panel > p {
  margin: 7px 3px 0;
  color: #7188a5;
  font-size: 7px;
  line-height: 11px;
  text-align: center;
}

.connection-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border: 2px solid #0b182a;
  border-radius: 50%;
  background: #f5b942;
  box-sizing: content-box;
}

.connection-dot.is-ready {
  background: #3bd3a2;
  box-shadow: 0 0 0 3px rgba(59, 211, 162, 0.12);
}

.connection-dot.is-danger {
  background: #ff7373;
  box-shadow: 0 0 0 3px rgba(255, 115, 115, 0.12);
}

.control-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  visibility: hidden;
  border: 0;
  background: rgba(0, 4, 10, 0.56);
  opacity: 0;
  padding: 0;
  transition:
    opacity 180ms ease,
    visibility 180ms;
  backdrop-filter: blur(3px);
}

.control-backdrop.is-open {
  visibility: visible;
  opacity: 1;
}

.control-sheet {
  position: fixed;
  z-index: 40;
  right: max(8px, env(safe-area-inset-right));
  bottom: max(8px, env(safe-area-inset-bottom));
  left: max(8px, env(safe-area-inset-left));
  visibility: hidden;
  max-height: min(78vh, 620px);
  overflow: auto;
  border: 1px solid rgba(128, 161, 205, 0.24);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(16, 32, 54, 0.98), rgba(7, 18, 32, 0.99));
  box-shadow:
    0 24px 72px rgba(0, 0, 0, 0.52),
    inset 0 1px rgba(255, 255, 255, 0.05);
  opacity: 0;
  padding: 14px;
  transform: translateY(calc(100% + 24px));
  transition:
    opacity 190ms ease,
    transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    visibility 220ms;
  overscroll-behavior: contain;
}

.control-sheet.is-open {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.settings-sheet {
  left: auto;
  width: min(390px, calc(100vw - 16px));
}

.keyboard-sheet {
  max-height: min(74vh, 520px);
}

.sheet-header,
.sheet-title,
.sheet-title > div,
.session-status-main,
.system-input {
  display: flex;
  align-items: center;
}

.sheet-header {
  justify-content: space-between;
  gap: 12px;
}

.sheet-title {
  min-width: 0;
  gap: 10px;
}

.sheet-title > img,
.keyboard-title-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid rgba(107, 158, 231, 0.24);
  border-radius: 11px;
  background: rgba(15, 107, 255, 0.12);
  padding: 6px;
}

.keyboard-title-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.keyboard-title-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: #78adff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.sheet-title > div:not(.keyboard-title-icon) {
  min-width: 0;
  align-items: flex-start;
  flex-direction: column;
}

.sheet-title strong {
  color: #f6f9ff;
  font-size: 15px;
  line-height: 20px;
}

.sheet-title span {
  overflow: hidden;
  max-width: 250px;
  margin-top: 2px;
  color: #8297b3;
  font-size: 9px;
  line-height: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-close {
  display: flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid rgba(132, 163, 203, 0.2);
  border-radius: 11px;
  background: rgba(27, 45, 69, 0.72);
  color: #aebdd0;
}

.sheet-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.session-status-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
  border: 1px solid rgba(126, 159, 201, 0.16);
  border-radius: 14px;
  background: rgba(4, 12, 23, 0.5);
  padding: 10px;
}

.session-status-main {
  grid-column: 1 / -1;
  gap: 7px;
  padding-bottom: 2px;
}

.status-badge,
.latency-badge {
  min-height: 26px;
  border: 1px solid rgba(128, 155, 192, 0.22);
  border-radius: 8px;
  background: rgba(27, 43, 65, 0.78);
  color: #c5d2e3;
  font-size: 10px;
  font-weight: 700;
  line-height: 24px;
  padding: 0 9px;
  white-space: nowrap;
}

.status-badge.is-ready {
  border-color: rgba(57, 217, 164, 0.3);
  background: rgba(18, 94, 72, 0.42);
  color: #7af0c8;
}

.status-badge.is-danger {
  border-color: rgba(255, 112, 112, 0.3);
  background: rgba(120, 36, 45, 0.42);
  color: #ffb1b1;
}

.session-detail {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
  border-radius: 10px;
  background: rgba(19, 36, 59, 0.58);
  padding: 9px 10px;
}

.session-detail span {
  color: #7187a3;
  font-size: 8px;
}

.session-detail strong {
  overflow: hidden;
  color: #dce8f7;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-tabs {
  display: none;
  gap: 7px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.device-tabs.is-visible {
  display: flex;
}

.device-tabs::-webkit-scrollbar {
  display: none;
}

.device-tab {
  min-width: 118px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid rgba(122, 153, 194, 0.22);
  border-radius: 10px;
  background: rgba(13, 27, 47, 0.88);
  color: #8fa4bf;
  padding: 0 10px;
  text-align: left;
}

.device-tab strong,
.device-tab small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-tab strong {
  color: #edf5ff;
  font-size: 10px;
}

.device-tab small {
  margin-top: 2px;
  font-size: 8px;
}

.device-tab.is-active {
  border-color: rgba(70, 144, 255, 0.78);
  background: rgba(15, 107, 255, 0.2);
}

.settings-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.settings-action {
  display: flex;
  min-width: 0;
  min-height: 64px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  border: 1px solid rgba(124, 159, 207, 0.2);
  border-radius: 12px;
  background: rgba(22, 42, 67, 0.72);
  color: #dce8f7;
  font-size: 9px;
  font-weight: 700;
}

.settings-action svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: #72a8f5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.settings-action.is-danger svg {
  stroke: #f39595;
}

.settings-action:disabled {
  opacity: 0.42;
}

.gesture-guide {
  display: flex;
  margin-top: 10px;
  flex-direction: column;
  gap: 3px;
  border-radius: 11px;
  background: rgba(7, 17, 31, 0.54);
  color: #788ca7;
  padding: 9px 10px;
}

.gesture-guide strong {
  color: #aebed2;
  font-size: 9px;
}

.gesture-guide span {
  font-size: 8px;
  line-height: 14px;
}

.settings-sheet {
  --panel-paper: #f5f7fb;
  --panel-card: #ffffff;
  --panel-ink: #101927;
  --panel-copy: #5f6d80;
  --panel-faint: #8d99a9;
  --panel-line: #e4e9f0;
  --panel-blue: #176bff;
  --panel-blue-soft: #eaf2ff;
  left: auto;
  display: flex;
  width: min(430px, calc(100vw - 12px));
  height: min(88dvh, 760px);
  max-height: min(88dvh, 760px);
  flex-direction: column;
  overflow: hidden;
  border-color: rgba(255, 255, 255, 0.78);
  border-radius: 30px;
  background: var(--panel-paper);
  color: var(--panel-ink);
  padding: 0;
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.5),
    inset 0 1px rgba(255, 255, 255, 0.9);
}

.settings-sheet .control-panel-header {
  position: relative;
  min-height: 72px;
  flex: 0 0 auto;
  padding: 15px 18px 9px;
}

.sheet-header-spacer,
.settings-sheet .sheet-close {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
}

.control-panel-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  flex-direction: column;
}

.control-panel-heading strong {
  color: var(--panel-ink);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.6px;
  line-height: 25px;
}

.control-panel-heading span {
  overflow: hidden;
  max-width: 220px;
  margin-top: 2px;
  color: var(--panel-faint);
  font-size: 9px;
  font-weight: 650;
  line-height: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-sheet .sheet-close {
  border-color: transparent;
  border-radius: 14px;
  background: transparent;
  color: #526071;
}

.settings-sheet .sheet-close:active {
  background: #e8ecf2;
}

.settings-sheet .sheet-close svg {
  width: 25px;
  height: 25px;
  stroke-width: 1.6;
}

.control-tabs {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 4px 18px 14px;
}

.control-tab {
  display: flex;
  min-width: 0;
  min-height: 78px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 17px;
  background: transparent;
  color: #667385;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 5px;
}

.control-tab-icon {
  display: flex;
  width: 34px;
  height: 31px;
  align-items: center;
  justify-content: center;
}

.control-tab svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.control-tab.is-active {
  border-color: #dbe1e9;
  background: var(--panel-card);
  color: var(--panel-ink);
  box-shadow:
    0 8px 22px rgba(35, 50, 72, 0.07),
    inset 0 0 0 1px rgba(255, 255, 255, 0.9);
}

.control-tab.is-active .control-tab-icon {
  color: var(--panel-blue);
}

.settings-tab-panels {
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 18px 18px;
  scrollbar-width: none;
}

.settings-tab-panels::-webkit-scrollbar {
  display: none;
}

.settings-tab-panel[hidden] {
  display: none;
}

.panel-section-heading {
  display: flex;
  min-height: 28px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #657286;
  font-size: 11px;
  font-weight: 700;
  padding: 0 5px 7px;
}

.panel-section-heading-spaced {
  margin-top: 16px;
}

.section-value,
.live-caption {
  color: var(--panel-blue);
  font-size: 9px;
  font-weight: 700;
}

.live-caption {
  display: flex;
  align-items: center;
  gap: 5px;
}

.live-caption i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #20bf88;
  box-shadow: 0 0 0 4px rgba(32, 191, 136, 0.1);
}

.display-card {
  overflow: hidden;
  border: 1px solid #edf0f4;
  border-radius: 18px;
  background: var(--panel-card);
  box-shadow: 0 8px 26px rgba(35, 50, 72, 0.045);
}

.setting-row {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-left: 15px;
  border-bottom: 1px solid var(--panel-line);
  padding: 10px 15px 10px 0;
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-row > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.setting-row span {
  color: var(--panel-ink);
  font-size: 13px;
  font-weight: 700;
}

.setting-row small {
  margin-top: 3px;
  color: var(--panel-faint);
  font-size: 9px;
  line-height: 13px;
}

.setting-row > strong {
  overflow: hidden;
  max-width: 52%;
  color: #4f5d6f;
  font-size: 12px;
  font-weight: 650;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quality-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  border: 1px solid #edf0f4;
  border-radius: 18px;
  background: var(--panel-card);
  padding: 7px;
  box-shadow: 0 8px 26px rgba(35, 50, 72, 0.045);
}

.quality-selector button {
  display: flex;
  min-width: 0;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #566478;
  padding: 6px 3px;
}

.quality-selector strong {
  font-size: 12px;
  line-height: 16px;
}

.quality-selector small {
  color: #9ba5b3;
  font-size: 8px;
  line-height: 11px;
}

.quality-selector button.is-active {
  border-color: #cfe0ff;
  background: var(--panel-blue-soft);
  color: var(--panel-blue);
}

.quality-selector button.is-active small {
  color: #5487dc;
}

.wide-setting-button,
.keyboard-entry,
.reconnect-button {
  display: flex;
  width: 100%;
  min-height: 66px;
  align-items: center;
  gap: 11px;
  border: 1px solid #edf0f4;
  border-radius: 18px;
  background: var(--panel-card);
  color: var(--panel-ink);
  padding: 10px 13px;
  text-align: left;
  box-shadow: 0 8px 26px rgba(35, 50, 72, 0.045);
}

.input-mode-selector {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.input-mode-selector > button {
  display: flex;
  min-width: 0;
  min-height: 82px;
  align-items: center;
  gap: 9px;
  border: 1px solid #e5eaf1;
  border-radius: 17px;
  background: var(--panel-card);
  color: #5a687b;
  padding: 10px;
  text-align: left;
  box-shadow: 0 8px 26px rgba(35, 50, 72, 0.04);
}

.input-mode-icon {
  display: flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  flex: 0 0 34px;
  border-radius: 11px;
  background: #f0f3f7;
  color: #6f7e91;
}

.input-mode-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}

.input-mode-selector > button > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.input-mode-selector strong {
  color: var(--panel-ink);
  font-size: 11px;
  line-height: 15px;
}

.input-mode-selector small {
  margin-top: 3px;
  color: var(--panel-faint);
  font-size: 7px;
  line-height: 11px;
}

.input-mode-selector > button.is-active {
  border-color: #a9c8ff;
  background: var(--panel-blue-soft);
  color: var(--panel-blue);
  box-shadow:
    0 8px 26px rgba(23, 107, 255, 0.08),
    inset 0 0 0 1px rgba(23, 107, 255, 0.06);
}

.input-mode-selector > button.is-active .input-mode-icon {
  background: #d9e8ff;
  color: var(--panel-blue);
}

.input-mode-selector > button.is-active strong {
  color: var(--panel-blue);
}

.input-mode-selector > button.is-active small {
  color: #5686d7;
}

.input-mode-selector > button:disabled {
  opacity: 0.48;
}

.wide-setting-icon,
.keyboard-entry-icon {
  display: flex;
  width: 39px;
  height: 39px;
  align-items: center;
  justify-content: center;
  flex: 0 0 39px;
  border-radius: 12px;
  background: var(--panel-blue-soft);
  color: var(--panel-blue);
}

.wide-setting-icon svg,
.keyboard-entry-icon svg,
.reconnect-button > svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.wide-setting-copy,
.keyboard-entry > span:nth-child(2),
.reconnect-button > span {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
}

.wide-setting-copy strong,
.keyboard-entry strong,
.reconnect-button strong {
  font-size: 12px;
  line-height: 16px;
}

.wide-setting-copy small,
.keyboard-entry small,
.reconnect-button small {
  margin-top: 2px;
  color: var(--panel-faint);
  font-size: 8px;
  line-height: 12px;
}

.wide-setting-chevron {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: #98a3b1;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.keyboard-entry:disabled,
.panel-quick-action:disabled {
  opacity: 0.48;
}

.gesture-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.gesture-item {
  display: flex;
  min-height: 68px;
  justify-content: center;
  flex-direction: column;
  border: 1px solid #edf0f4;
  border-radius: 15px;
  background: var(--panel-card);
  padding: 10px 13px;
}

.gesture-item.is-wide {
  grid-column: 1 / -1;
}

.gesture-item strong {
  color: var(--panel-ink);
  font-size: 11px;
}

.gesture-item span {
  margin-top: 4px;
  color: var(--panel-faint);
  font-size: 8px;
  line-height: 12px;
}

.settings-sheet .session-status-card {
  display: flex;
  margin-top: 0;
  flex-direction: column;
  gap: 9px;
  border-color: #dce5f0;
  border-radius: 18px;
  background:
    radial-gradient(circle at 100% 0, rgba(23, 107, 255, 0.13), transparent 46%),
    var(--panel-card);
  padding: 15px;
  box-shadow: 0 8px 26px rgba(35, 50, 72, 0.045);
}

.settings-sheet .session-status-main {
  gap: 8px;
}

.settings-sheet .status-badge,
.settings-sheet .latency-badge {
  min-height: 28px;
  border-color: #dfe5ed;
  background: #f2f5f9;
  color: #5a687a;
  line-height: 26px;
}

.settings-sheet .status-badge.is-ready {
  border-color: #bdebdc;
  background: #e9f9f3;
  color: #138b65;
}

.settings-sheet .status-badge.is-danger {
  border-color: #f0ccd2;
  background: #fff0f2;
  color: #c43c52;
}

.settings-sheet .session-status-card p {
  margin: 0;
  color: var(--panel-copy);
  font-size: 9px;
  line-height: 15px;
}

.settings-sheet .device-tabs {
  margin-top: 11px;
}

.settings-sheet .device-tab {
  min-width: 132px;
  height: 49px;
  border-color: #e0e6ee;
  border-radius: 13px;
  background: var(--panel-card);
  color: var(--panel-faint);
  padding: 0 12px;
}

.settings-sheet .device-tab strong {
  color: var(--panel-ink);
}

.settings-sheet .device-tab.is-active {
  border-color: #9fc1ff;
  background: var(--panel-blue-soft);
}

.reconnect-button {
  margin-top: 14px;
  border-color: #f0dfe2;
  color: #bd3850;
}

.reconnect-button > svg {
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
}

.control-panel-footer {
  display: grid;
  min-height: 80px;
  flex: 0 0 auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid #dfe4eb;
  background: rgba(250, 251, 253, 0.96);
  padding: 8px 14px max(10px, env(safe-area-inset-bottom));
  box-shadow: 0 -12px 30px rgba(40, 53, 71, 0.05);
}

.panel-quick-action {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #4f5d70;
  font-size: 9px;
  font-weight: 700;
}

.panel-quick-action:active {
  background: #edf1f6;
}

.panel-quick-action.is-danger {
  color: #c23f54;
}

.panel-quick-action.is-danger:active {
  background: #fff0f2;
}

.panel-quick-action svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: #334357;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.panel-quick-action.is-danger svg {
  stroke: #c23f54;
}

.keyboard-sheet {
  right: max(8px, env(safe-area-inset-right));
  left: max(8px, env(safe-area-inset-left));
  width: min(760px, calc(100vw - 16px));
  margin: 0 auto;
  border-color: rgba(161, 180, 207, 0.34);
  border-radius: 18px;
  background: #070b12;
  padding: 6px;
}

.keyboard-shortcut-bar {
  display: flex;
  min-height: 50px;
  align-items: stretch;
  gap: 6px;
}

.keyboard-ime-button,
.keyboard-shortcut-key,
.keyboard-more-button,
.keyboard-close-button {
  display: flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: #111822;
  color: #f6f8fc;
  font-size: 13px;
  font-weight: 700;
}

.keyboard-ime-button {
  width: 66px;
  flex: 0 0 66px;
  flex-direction: column;
  gap: 1px;
  color: #b7ceee;
}

.keyboard-ime-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.keyboard-ime-button span {
  font-size: 8px;
  line-height: 10px;
}

.keyboard-modifier-group {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.keyboard-shortcut-key {
  padding: 0 7px;
}

.keyboard-shortcut-key.is-active {
  border-color: rgba(109, 168, 255, 0.95);
  background: #1f68cc;
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(173, 211, 255, 0.22);
}

.keyboard-more-button {
  width: 45px;
  flex: 0 0 45px;
  color: #cbd5e3;
  font-size: 16px;
  letter-spacing: 1px;
  padding-bottom: 6px;
}

.keyboard-more-button.is-active {
  border-color: rgba(111, 163, 242, 0.68);
  background: #1b365e;
  color: #fff;
}

.keyboard-close-button {
  width: 44px;
  flex: 0 0 44px;
  color: #bec9d7;
}

.keyboard-close-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.keyboard-ime-button:active,
.keyboard-shortcut-key:active,
.keyboard-more-button:active,
.keyboard-close-button:active {
  background: #243344;
  transform: translateY(1px);
}

.system-input {
  min-height: 48px;
  gap: 9px;
  margin-top: 12px;
  border: 1px solid rgba(92, 146, 221, 0.34);
  border-radius: 13px;
  background: rgba(4, 12, 23, 0.74);
  padding: 5px 7px;
}

.system-input:focus-within {
  border-color: rgba(67, 144, 255, 0.82);
  box-shadow: 0 0 0 3px rgba(41, 124, 245, 0.1);
}

.system-input-icon {
  display: flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 9px;
  background: rgba(15, 107, 255, 0.18);
  color: #79adfa;
  font-size: 12px;
  font-weight: 800;
}

.system-input input {
  min-width: 0;
  height: 36px;
  flex: 1 1 auto;
  border: 0;
  outline: none;
  background: transparent;
  color: #fff;
  font-size: 12px;
  padding: 0 4px;
}

.system-input input::placeholder {
  color: #7186a2;
}

.keyboard-ime-input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  height: 1px;
  margin: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0;
  pointer-events: none;
}

.keyboard-ime-input .system-input-icon,
.keyboard-ime-input input {
  width: 1px;
  min-width: 1px;
  height: 1px;
  padding: 0;
}

.keyboard-extra-panel {
  margin-top: 8px;
}

.keyboard-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.keyboard-action-key {
  min-height: 38px;
  border: 1px solid rgba(141, 174, 216, 0.2);
  border-radius: 9px;
  background: #101b29;
  color: #c9d7e8;
  font-size: 9px;
  font-weight: 700;
  padding: 0 4px;
}

.keyboard-action-key:active {
  border-color: #66a4ff;
  background: #1d5fb5;
  color: #fff;
}

.keyboard-extra-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 11px;
  color: #d5e0ed;
  font-size: 10px;
  font-weight: 750;
  padding: 0 2px;
}

.keyboard-extra-heading small {
  color: #8294a9;
  font-size: 8px;
  font-weight: 500;
}

.virtual-keyboard {
  display: flex;
  margin-top: 10px;
  flex-direction: column;
  gap: 5px;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.virtual-key-row {
  display: flex;
  gap: 4px;
}

.virtual-key {
  min-width: 0;
  height: 42px;
  flex: var(--key-weight, 1) 1 0;
  border: 1px solid rgba(142, 171, 209, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(38, 59, 84, 0.98), rgba(22, 39, 61, 0.98));
  color: #f0f5fc;
  font-size: 11px;
  font-weight: 650;
  padding: 0 2px;
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.05),
    0 2px 0 rgba(0, 0, 0, 0.22);
}

.virtual-key.is-special {
  background:
    linear-gradient(180deg, rgba(27, 49, 76, 0.98), rgba(15, 32, 53, 0.98));
  color: #a9bed8;
  font-size: 9px;
}

.virtual-key.is-active {
  border-color: rgba(80, 154, 255, 0.9);
  background: rgba(15, 107, 255, 0.46);
  color: #fff;
  box-shadow:
    inset 0 0 0 1px rgba(126, 181, 255, 0.2),
    0 0 0 2px rgba(15, 107, 255, 0.12);
}

.virtual-key:active {
  border-color: #62a4ff;
  background: #176edc;
  color: #fff;
  transform: translateY(1px);
  box-shadow: none;
}

@media (max-width: 430px) {
  .session-controls {
    right: max(10px, calc(env(safe-area-inset-right) + 7px));
    bottom: max(12px, calc(env(safe-area-inset-bottom) + 8px));
    gap: 7px;
  }

  .floating-control {
    width: 48px;
    height: 48px;
    border-radius: 15px;
  }

  .virtual-mouse-panel {
    left: max(10px, calc(env(safe-area-inset-left) + 7px));
    bottom: max(76px, calc(env(safe-area-inset-bottom) + 72px));
    width: min(236px, calc(100vw - 20px));
  }

  .control-sheet {
    right: max(5px, env(safe-area-inset-right));
    bottom: max(5px, env(safe-area-inset-bottom));
    left: max(5px, env(safe-area-inset-left));
    border-radius: 19px;
    padding: 11px;
  }

  .settings-sheet {
    width: auto;
  }

  .control-sheet.settings-sheet {
    height: min(90dvh, 760px);
    max-height: min(90dvh, 760px);
    border-radius: 27px;
    padding: 0;
  }

  .settings-sheet .control-panel-header {
    min-height: 66px;
    padding: 12px 14px 7px;
  }

  .control-panel-heading strong {
    font-size: 18px;
  }

  .control-tabs {
    gap: 5px;
    padding: 3px 14px 11px;
  }

  .control-tab {
    min-height: 70px;
    border-radius: 15px;
  }

  .settings-tab-panels {
    padding: 0 14px 14px;
  }

  .input-mode-selector > button {
    min-height: 76px;
    padding: 8px;
  }

  .input-mode-icon {
    width: 31px;
    height: 31px;
    flex-basis: 31px;
  }

  .control-panel-footer {
    min-height: 74px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .keyboard-sheet {
    max-height: min(78vh, 500px);
  }

  .virtual-key-row {
    gap: 3px;
  }

  .virtual-key {
    height: 40px;
    border-radius: 7px;
    font-size: 10px;
  }

  .virtual-key.is-special {
    font-size: 8px;
  }

  .sheet-title span {
    max-width: 220px;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .virtual-mouse-panel {
    left: max(10px, calc(env(safe-area-inset-left) + 6px));
    bottom: max(10px, calc(env(safe-area-inset-bottom) + 6px));
    width: 226px;
    border-radius: 20px;
    padding: 7px;
  }

  .virtual-mouse-header {
    height: 27px;
  }

  .virtual-mouse-body {
    grid-template-rows: 38px 66px;
  }

  .virtual-mouse-wheel-stack {
    top: 2px;
    transform: translateX(-50%) scale(0.82);
    transform-origin: top center;
  }

  .virtual-mouse-trackpad {
    padding-top: 7px;
    padding-bottom: 4px;
  }

  .virtual-mouse-panel > p {
    display: none;
  }

  .control-sheet {
    top: max(6px, env(safe-area-inset-top));
    bottom: max(6px, env(safe-area-inset-bottom));
    max-height: none;
  }

  .settings-sheet {
    left: auto;
    width: min(390px, 52vw);
  }

  .control-sheet.settings-sheet {
    height: auto;
    max-height: none;
    border-radius: 22px;
    padding: 0;
  }

  .settings-sheet .control-panel-header {
    min-height: 58px;
    padding: 8px 12px 4px;
  }

  .control-tabs {
    padding: 2px 12px 8px;
  }

  .control-tab {
    min-height: 54px;
    flex-direction: row;
    gap: 5px;
  }

  .control-tab-icon,
  .control-tab svg {
    width: 22px;
    height: 22px;
  }

  .settings-tab-panels {
    padding: 0 12px 10px;
  }

  .setting-row {
    min-height: 54px;
  }

  .panel-section-heading-spaced {
    margin-top: 9px;
  }

  .quality-selector button {
    min-height: 48px;
  }

  .control-panel-footer {
    min-height: 58px;
    padding: 3px 8px max(4px, env(safe-area-inset-bottom));
  }

  .panel-quick-action {
    min-height: 48px;
  }

  .keyboard-sheet {
    left: max(8px, env(safe-area-inset-left));
    width: min(680px, calc(100vw - 16px));
    margin: 0 auto;
  }

  .virtual-key {
    height: 36px;
  }

  .system-input {
    min-height: 42px;
  }

  .system-input-icon,
  .system-input input {
    height: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Transparent radial virtual mouse */
.virtual-mouse-panel {
  position: fixed;
  z-index: 23;
  left: calc(50% - 48px);
  bottom: max(16px, calc(env(safe-area-inset-bottom) + 10px));
  width: min(96px, calc(100vw - 16px));
  height: 110px;
  visibility: hidden;
  border: 0;
  border-radius: 0;
  background: none;
  color: #5f6268;
  opacity: 0;
  padding: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.94);
  transform-origin: left bottom;
  box-shadow: none;
  backdrop-filter: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    visibility 160ms;
}

.virtual-mouse-panel.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: none;
  transform: translateY(0) scale(1);
}

.virtual-mouse-panel.is-moving {
  transition: none;
  box-shadow: none;
}

body.is-sheet-open .virtual-mouse-panel {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.98);
}

.virtual-mouse-close {
  position: absolute;
  z-index: 8;
  top: -3px;
  right: -8px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  padding: 0;
  pointer-events: auto;
  box-shadow: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.virtual-mouse-close img {
  display: block;
  width: 8px;
  height: 8px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.34));
}

.virtual-mouse-close:active {
  transform: scale(0.92);
}

.virtual-mouse-body {
  position: relative;
  display: block;
  overflow: visible;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: none;
  pointer-events: none;
  box-shadow: none;
}

.virtual-mouse-scroll-mode,
.virtual-mouse-move-handle {
  position: absolute;
  z-index: 5;
  left: 50%;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  pointer-events: auto;
  transform: translateX(-50%);
  box-shadow: none;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.virtual-mouse-scroll-mode {
  top: -9px;
  width: 36px;
  height: 36px;
}

.virtual-mouse-scroll-mode img {
  display: block;
  width: 18px;
  height: 18px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.28));
}

.virtual-mouse-scroll-mode.is-active {
  filter: brightness(0.9);
}

.virtual-scroll-orbit {
  --scroll-angle: -45deg;
  position: absolute;
  z-index: 7;
  top: 12px;
  left: 50%;
  display: block;
  width: 52px;
  height: 52px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.72);
  transition:
    opacity 110ms ease,
    transform 150ms cubic-bezier(0.22, 0.88, 0.34, 1),
    visibility 110ms;
}

.virtual-scroll-orbit.is-active {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.virtual-scroll-orbit i,
.virtual-scroll-orbit b {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  border-radius: 50%;
  pointer-events: none;
}

.virtual-scroll-orbit i {
  width: 3px;
  height: 3px;
  background: rgba(164, 166, 170, 0.92);
  transform:
    translate(-50%, -50%)
    rotate(calc(var(--orbit-index) * 30deg))
    translateY(-22px);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.14),
    0 0 0 1px rgba(255, 255, 255, 0.34);
}

.virtual-scroll-orbit b {
  width: 7px;
  height: 7px;
  background: #ff4f70;
  transform:
    translate(-50%, -50%)
    rotate(var(--scroll-angle))
    translateX(22px);
  box-shadow:
    0 0 0 3px rgba(255, 83, 116, 0.13),
    0 0 8px 4px rgba(255, 67, 105, 0.46);
  transition: box-shadow 90ms linear;
}

.virtual-mouse-key {
  position: absolute;
  z-index: 3;
  top: 14px;
  display: block;
  width: 34px;
  height: 70px;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 0;
  padding: 0;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.virtual-mouse-key.is-left {
  left: -5px;
  justify-content: initial;
  border: 0;
  border-radius: 0;
}

.virtual-mouse-key.is-right {
  right: -5px;
  justify-content: initial;
  border: 0;
  border-radius: 0;
  transform: none;
}

.virtual-mouse-key > img {
  display: block;
  width: 24px;
  height: 61px;
  margin: auto;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.28));
}

.virtual-mouse-key .virtual-mouse-paddle-surface {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: currentColor;
  stroke: rgba(92, 95, 99, 0.9);
  stroke-linejoin: round;
  stroke-width: 2;
  filter: drop-shadow(0 5px 5px rgba(20, 22, 25, 0.18));
}

.virtual-mouse-key .virtual-mouse-key-icon {
  position: absolute;
  top: 59px;
  left: 18px;
  width: 23px;
  height: 23px;
  fill: none;
  stroke: #777a7f;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}

.virtual-mouse-key.is-right .virtual-mouse-key-icon {
  transform: scaleX(-1);
}

.virtual-mouse-key .virtual-mouse-key-icon .virtual-mouse-key-accent {
  fill: rgba(255, 104, 72, 0.64);
  stroke: none;
}

.virtual-mouse-key.is-active {
  background: transparent;
  color: #ffd994;
  box-shadow: none;
  transform: scale(0.96);
}

.virtual-mouse-key.is-right.is-active {
  transform: scale(0.96);
}

.virtual-mouse-key.is-active > img {
  filter: brightness(0.88) drop-shadow(0 0 3px rgba(255, 174, 65, 0.3));
}

.virtual-mouse-key.is-active .virtual-mouse-paddle-surface {
  stroke: rgba(213, 145, 44, 0.95);
  filter:
    drop-shadow(0 0 8px rgba(255, 174, 65, 0.34))
    drop-shadow(0 7px 8px rgba(20, 22, 25, 0.16));
}

.virtual-mouse-trackpad {
  position: absolute;
  z-index: 4;
  top: 23px;
  left: 50%;
  display: grid;
  width: 54px;
  height: 54px;
  min-width: 0;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  pointer-events: auto;
  text-align: center;
  transform: translateX(-50%);
  box-shadow: none;
  touch-action: none;
  user-select: none;
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
}

.virtual-mouse-trackpad > img {
  display: block;
  width: 47px;
  height: 49px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.28));
}

.virtual-mouse-trackpad svg path:first-child {
  fill: #fbfbfa;
  stroke: #4e5157;
  stroke-width: 1.5;
}

.virtual-mouse-trackpad.is-active {
  background: transparent;
  box-shadow: none;
  cursor: grabbing;
}

.virtual-mouse-trackpad.is-active > img {
  filter: brightness(0.88) drop-shadow(0 0 3px rgba(255, 174, 65, 0.28));
}

.virtual-mouse-move-handle {
  top: 71px;
  width: 36px;
  height: 36px;
}

.virtual-mouse-move-handle::before {
  position: absolute;
  display: none;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(101, 103, 108, 0.6) 1.15px, transparent 1.45px)
    0 0 / 5.5px 5.5px;
  content: "";
}

.virtual-mouse-move-handle img {
  position: relative;
  display: block;
  width: 23px;
  height: 23px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.28));
}

.virtual-mouse-move-handle::before {
  opacity: 0.22;
}

.virtual-mouse-move-handle.is-active {
  background: transparent;
  transform: translateX(-50%) scale(0.94);
  box-shadow: none;
}

.virtual-mouse-move-handle.is-active img {
  filter: brightness(0.86) drop-shadow(0 0 3px rgba(255, 174, 65, 0.28));
}

/* CloudPC control panel v2 — mirrors the approved 390 × 844 design. */
.control-backdrop {
  background: rgba(0, 5, 13, 0.22);
  backdrop-filter: blur(1.5px);
}

.settings-sheet {
  --panel-paper: rgba(10, 21, 39, 0.975);
  --panel-card: rgba(19, 33, 55, 0.72);
  --panel-card-strong: rgba(23, 39, 64, 0.88);
  --panel-ink: #edf3fd;
  --panel-copy: #bdc8d9;
  --panel-faint: #8795aa;
  --panel-line: rgba(137, 160, 194, 0.17);
  --panel-blue: #2178ff;
  --panel-blue-strong: #0f6bff;
  --panel-green: #3bdf86;
  --panel-red: #ff6868;
  right: max(8px, env(safe-area-inset-right));
  bottom: max(8px, env(safe-area-inset-bottom));
  left: auto;
  display: flex;
  width: min(430px, calc(100vw - 16px));
  height: min(78dvh, 700px);
  max-height: min(78dvh, 700px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(118, 147, 190, 0.23);
  border-radius: 30px;
  background:
    radial-gradient(circle at 76% -12%, rgba(29, 100, 211, 0.16), transparent 38%),
    linear-gradient(180deg, rgba(16, 29, 50, 0.985), rgba(8, 19, 35, 0.992));
  color: var(--panel-ink);
  padding: 0;
  box-shadow:
    0 -18px 70px rgba(0, 0, 0, 0.42),
    inset 0 1px rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(24px) saturate(118%);
}

.settings-sheet .control-panel-header {
  position: relative;
  display: flex;
  min-height: 116px;
  align-items: center;
  justify-content: flex-start;
  flex: 0 0 auto;
  gap: 16px;
  padding: 29px 21px 16px;
}

.panel-drag-handle {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 46px;
  height: 5px;
  border: 0;
  border-radius: 999px;
  background: rgba(143, 160, 187, 0.42);
  padding: 0;
  transform: translateX(-50%);
}

.panel-drag-handle:active {
  background: rgba(171, 188, 213, 0.66);
}

.device-avatar {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  flex: 0 0 54px;
  border: 1px solid rgba(60, 126, 235, 0.2);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(35, 104, 220, 0.34), rgba(15, 62, 137, 0.18)),
    rgba(15, 50, 105, 0.34);
  color: #4b91ff;
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.04),
    0 10px 28px rgba(0, 76, 190, 0.14);
}

.device-avatar svg {
  width: 31px;
  height: 31px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.control-panel-heading {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: center;
  flex: 1 1 auto;
  flex-direction: column;
}

.control-panel-heading > strong {
  overflow: hidden;
  max-width: 100%;
  color: #f8fbff;
  font-size: 24px;
  font-weight: 760;
  letter-spacing: -0.8px;
  line-height: 31px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-session-state {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--panel-green);
  font-size: 14px;
  font-weight: 560;
  line-height: 20px;
}

.header-session-state > i {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #f4b94b;
  box-shadow: 0 0 0 4px rgba(244, 185, 75, 0.08);
}

.header-session-state.is-ready > i {
  background: var(--panel-green);
  box-shadow: 0 0 0 4px rgba(59, 223, 134, 0.08);
}

.header-session-state.is-danger {
  color: #ff8a8a;
}

.header-session-state.is-danger > i {
  background: var(--panel-red);
  box-shadow: 0 0 0 4px rgba(255, 104, 104, 0.08);
}

.header-status-badge,
.header-latency-badge {
  overflow: hidden;
  color: inherit;
  font: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-session-state > b {
  color: currentColor;
  font-size: 12px;
  font-weight: 600;
}

.control-tabs {
  position: relative;
  display: grid;
  min-height: 60px;
  flex: 0 0 60px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-bottom: 1px solid var(--panel-line);
  padding: 0 18px;
}

.control-tab {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 60px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #9aa7ba;
  font-size: 15px;
  font-weight: 560;
  padding: 0 6px;
  box-shadow: none;
}

.control-tab::after {
  position: absolute;
  right: 32%;
  bottom: -1px;
  left: 32%;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: transparent;
  content: "";
}

.control-tab.is-active {
  border: 0;
  background: transparent;
  color: var(--panel-blue);
  box-shadow: none;
}

.control-tab.is-active::after {
  background: var(--panel-blue);
  box-shadow: 0 0 12px rgba(33, 120, 255, 0.34);
}

.control-tab:focus-visible {
  border-radius: 8px;
  outline: 1px solid rgba(91, 151, 244, 0.62);
  outline-offset: -5px;
}

.settings-tab-panels {
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 13px 20px 16px;
  scrollbar-width: none;
}

.settings-tab-panels::-webkit-scrollbar {
  display: none;
}

.settings-tab-panel[hidden] {
  display: none;
}

.panel-section-heading {
  display: flex;
  min-height: 25px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #aeb9c9;
  font-size: 13px;
  font-weight: 610;
  line-height: 18px;
  padding: 0 1px 7px;
}

.panel-section-heading-spaced {
  margin-top: 13px;
}

.section-value {
  color: #71829a;
  font-size: 10px;
  font-weight: 560;
}

#displaySettings .section-value {
  display: none;
}

.display-card {
  display: flex;
  min-height: 64px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--panel-line);
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(27, 43, 68, 0.72), rgba(18, 32, 52, 0.72));
  padding: 0 16px;
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.025),
    0 12px 28px rgba(0, 0, 0, 0.07);
}

.display-card-icon {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  flex: 0 0 31px;
  color: #b7c4d8;
}

.display-card-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}

.display-card > strong {
  color: #bdc7d7;
  font-size: 13px;
  font-weight: 540;
  white-space: nowrap;
}

.display-card-icon + strong {
  margin-left: 12px;
}

.display-card-divider {
  width: 1px;
  height: 32px;
  margin: 0 auto;
  background: var(--panel-line);
}

.video-status-icon {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  flex: 0 0 27px;
  border: 2px solid var(--panel-green);
  border-radius: 50%;
  color: var(--panel-green);
}

.video-status-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.display-card .video-status-text {
  overflow: hidden;
  max-width: 86px;
  margin-left: 9px;
  text-overflow: ellipsis;
}

.quality-selector {
  display: grid;
  min-height: 56px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--panel-line);
  border-radius: 15px;
  background: rgba(16, 29, 48, 0.72);
  padding: 0;
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.02),
    0 12px 28px rgba(0, 0, 0, 0.06);
}

.quality-selector button {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #adb8c9;
  padding: 0 5px;
}

.quality-selector strong {
  font-size: 14px;
  font-weight: 560;
  line-height: 20px;
}

.quality-selector button.is-active {
  border: 0;
  background: linear-gradient(130deg, #217bff, #0963ee);
  color: #fff;
  box-shadow:
    0 8px 20px rgba(8, 84, 205, 0.28),
    inset 0 1px rgba(255, 255, 255, 0.15);
}

.quality-recommend {
  position: absolute;
  top: 6px;
  right: 7px;
  display: none;
  min-height: 16px;
  border-radius: 5px;
  background: #eaf2ff;
  color: #176bff;
  font-size: 8px;
  font-weight: 750;
  line-height: 16px;
  padding: 0 5px;
}

.quality-selector button.is-active .quality-recommend {
  display: block;
  color: #176bff;
}

.display-mode-selector {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.display-mode-selector > button {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 112px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--panel-line);
  border-radius: 16px;
  background: rgba(17, 31, 51, 0.72);
  color: #b8c4d5;
  padding: 12px 8px 10px;
}

.display-mode-selector > button.is-active {
  border-color: var(--panel-blue);
  background:
    radial-gradient(circle at 24% 18%, rgba(35, 115, 242, 0.14), transparent 55%),
    rgba(19, 34, 56, 0.82);
  color: #e3ebf8;
  box-shadow:
    inset 0 0 0 1px rgba(33, 120, 255, 0.2),
    0 10px 26px rgba(0, 74, 182, 0.12);
}

.display-mode-icon {
  display: grid;
  width: 47px;
  height: 43px;
  place-items: center;
  color: #aebbd0;
}

.display-mode-icon svg {
  width: 43px;
  height: 43px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
}

.display-mode-selector strong {
  font-size: 13px;
  font-weight: 560;
  line-height: 18px;
}

.display-mode-check {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border: 1.5px solid #74849a;
  border-radius: 50%;
  color: transparent;
}

.display-mode-selector > button.is-active .display-mode-check {
  border-color: #7eb1ff;
  background: var(--panel-blue);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(33, 120, 255, 0.1);
}

.display-mode-check svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.1;
}

.input-mode-selector {
  gap: 10px;
}

.input-mode-selector > button,
.keyboard-entry,
.gesture-item,
.settings-sheet .session-status-card,
.settings-sheet .device-tab,
.reconnect-button {
  border-color: var(--panel-line);
  background: var(--panel-card);
  color: var(--panel-copy);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.025),
    0 10px 26px rgba(0, 0, 0, 0.07);
}

.input-mode-selector > button {
  min-height: 79px;
  border-radius: 15px;
}

.input-mode-icon,
.wide-setting-icon,
.keyboard-entry-icon {
  background: rgba(35, 100, 202, 0.18);
  color: #6fa5fa;
}

.input-mode-selector strong,
.keyboard-entry strong,
.gesture-item strong,
.settings-sheet .device-tab strong,
.reconnect-button strong,
.settings-sheet .session-status-main strong {
  color: var(--panel-ink);
}

.input-mode-selector small,
.keyboard-entry small,
.gesture-item span,
.reconnect-button small,
.settings-sheet .session-status-card p {
  color: var(--panel-faint);
}

.input-mode-selector > button.is-active {
  border-color: rgba(64, 133, 240, 0.82);
  background: rgba(25, 75, 155, 0.24);
  color: #7eb1ff;
  box-shadow:
    inset 0 0 0 1px rgba(33, 120, 255, 0.12),
    0 10px 26px rgba(0, 60, 150, 0.1);
}

.input-mode-selector > button.is-active .input-mode-icon {
  background: rgba(33, 120, 255, 0.2);
  color: #83b4ff;
}

.input-mode-selector > button.is-active strong {
  color: #dceaff;
}

.input-mode-selector > button.is-active small {
  color: #8aa9d2;
}

.keyboard-entry,
.reconnect-button {
  min-height: 64px;
  border-radius: 15px;
}

.gesture-grid {
  gap: 9px;
}

.gesture-item {
  min-height: 64px;
  border-radius: 14px;
}

.settings-sheet .session-status-card {
  gap: 6px;
  border-radius: 15px;
  padding: 15px;
}

.settings-sheet .session-status-main {
  padding: 0;
}

.settings-sheet .session-status-card p {
  font-size: 9px;
  line-height: 15px;
}

.settings-sheet .device-tab {
  border-radius: 13px;
}

.settings-sheet .device-tab.is-active {
  border-color: rgba(62, 133, 243, 0.86);
  background: rgba(29, 91, 186, 0.22);
}

.reconnect-button {
  border-color: rgba(255, 104, 104, 0.23);
  color: #ff8a8a;
}

.control-panel-footer {
  display: grid;
  min-height: 82px;
  flex: 0 0 auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--panel-line);
  background: rgba(8, 18, 34, 0.9);
  padding: 7px 12px max(8px, env(safe-area-inset-bottom));
  box-shadow: 0 -14px 30px rgba(0, 0, 0, 0.09);
  backdrop-filter: blur(16px);
}

.panel-quick-action {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 62px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: #d1dae8;
  font-size: 10px;
  font-weight: 560;
}

.panel-quick-action + .panel-quick-action::before {
  position: absolute;
  top: 11px;
  bottom: 11px;
  left: 0;
  width: 1px;
  background: var(--panel-line);
  content: "";
}

.panel-quick-action svg {
  width: 26px;
  height: 26px;
  stroke: #c3cede;
  stroke-width: 1.6;
}

.panel-quick-action:active {
  background: rgba(97, 124, 160, 0.12);
}

.panel-quick-action.is-danger,
.panel-quick-action.is-danger svg {
  color: var(--panel-red);
  stroke: var(--panel-red);
}

.panel-quick-action.is-danger:active {
  background: rgba(255, 104, 104, 0.1);
}

@media (max-width: 430px) {
  .control-sheet.settings-sheet {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 71.2dvh;
    max-height: 71.2dvh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 29px 29px 0 0;
  }

  .settings-sheet .control-panel-header {
    min-height: 90px;
    gap: 15px;
    padding: 0 20px;
  }

  .device-avatar {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
    border-radius: 17px;
  }

  .control-panel-heading > strong {
    font-size: 23px;
    line-height: 29px;
  }

  .header-session-state {
    font-size: 13px;
    line-height: 18px;
  }

  .control-tabs,
  .control-tab {
    min-height: 36px;
  }

  .control-tabs {
    flex-basis: 36px;
    padding: 0 17px;
  }

  .settings-tab-panels {
    padding: 22px 20px 14px;
  }

  .panel-section-heading-spaced {
    margin-top: 31px;
  }

  #displaySettings .quality-selector + .panel-section-heading {
    margin-top: 29px;
  }

  .display-card {
    min-height: 54px;
  }

  .control-panel-footer {
    min-height: 80px;
    padding-right: 10px;
    padding-left: 10px;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .control-sheet.settings-sheet {
    top: max(6px, env(safe-area-inset-top));
    right: max(6px, env(safe-area-inset-right));
    bottom: max(6px, env(safe-area-inset-bottom));
    left: auto;
    width: min(390px, 52vw);
    height: auto;
    max-height: none;
    border: 1px solid rgba(118, 147, 190, 0.23);
    border-radius: 24px;
  }

  .settings-sheet .control-panel-header {
    min-height: 82px;
    gap: 11px;
    padding: 24px 14px 9px;
  }

  .device-avatar {
    width: 43px;
    height: 43px;
    flex-basis: 43px;
    border-radius: 14px;
  }

  .device-avatar svg {
    width: 25px;
    height: 25px;
  }

  .control-panel-heading > strong {
    font-size: 18px;
    line-height: 23px;
  }

  .header-session-state {
    margin-top: 1px;
    font-size: 10px;
  }

  .control-tabs,
  .control-tab {
    min-height: 46px;
  }

  .control-tabs {
    flex-basis: 46px;
  }

  .settings-tab-panels {
    padding: 9px 14px 10px;
  }

  .display-card {
    min-height: 54px;
  }

  .quality-selector,
  .quality-selector button {
    min-height: 47px;
  }

  .display-mode-selector > button {
    min-height: 82px;
    gap: 4px;
  }

  .display-mode-icon,
  .display-mode-icon svg {
    width: 34px;
    height: 34px;
  }

  .control-panel-footer {
    min-height: 58px;
    padding: 3px 8px max(4px, env(safe-area-inset-bottom));
  }

  .panel-quick-action {
    min-height: 50px;
  }
}
