.remote-viewer {
  --remote-radius: 14px;
  width: 100%;
  min-width: 0;
  padding: max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  color: var(--text);
}
.remote-heading,
.remote-pane-heading,
.remote-type-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.remote-heading {
  margin: 0 0 20px;
}
.remote-identity {
  min-width: 0;
}
.remote-identity h1 {
  font-size: 1.65rem;
  overflow-wrap: anywhere;
}
.remote-connection-status,
.remote-pane-status {
  color: var(--muted);
  font-size: 0.85rem;
}
.remote-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  min-height: 540px;
  height: min(880px, calc(100dvh - 120px));
  border: 1px solid var(--line);
  border-radius: var(--remote-radius);
  background: var(--surface);
  overflow: hidden;
}
.remote-navigation {
  overflow: auto;
  padding: 18px 10px;
  border-right: 1px solid var(--line);
}
.remote-navigation h2 {
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.85rem;
}
.remote-pane-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.remote-pane-choice {
  width: 100%;
  min-height: 64px;
  padding: 10px 12px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
}
.remote-pane-choice:hover {
  background: var(--surface-2);
}
.remote-pane-choice[aria-current="true"] {
  background: var(--accent-soft);
  border-color: var(--line);
  color: var(--accent);
}
.remote-pane-name {
  display: block;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.remote-pane-choice small {
  display: block;
  margin-top: 3px;
  font-size: 0.78rem;
}
.remote-workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.remote-pane-heading {
  flex-shrink: 0;
  min-height: 62px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.remote-pane-heading h2 {
  font-size: 1.05rem;
  margin: 0;
  overflow-wrap: anywhere;
}
.remote-pane-status {
  overflow-wrap: anywhere;
}
.remote-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 100px;
  overflow: hidden;
  position: relative;
}
.remote-message,
.remote-empty {
  padding: 24px;
  margin: 0;
  color: var(--muted);
}
.remote-message {
  overflow: auto;
}
.remote-chat-scroll,
.remote-surface-scroll,
.remote-note {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
.remote-chat-scroll {
  padding: 20px;
}
.remote-messages {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.remote-chat-message {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}
.remote-chat-message strong {
  color: var(--accent);
  font-size: 0.86rem;
}
.remote-chat-message pre,
.remote-live,
.remote-note {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  line-height: 1.6;
}
.remote-chat-message pre {
  margin: 7px 0 0;
}
.remote-live {
  margin: 18px 0 0;
  padding: 16px;
  background: var(--surface-2);
  border-radius: 10px;
}
.remote-history-hint {
  font-size: 0.8rem;
  color: var(--muted);
}
.remote-note {
  margin: 0;
  padding: 20px;
}
.remote-surface-scroll {
  background: #111619;
}
.remote-terminal {
  display: block;
  max-width: none;
}
.remote-terminal-text {
  margin: 0;
  min-width: max-content;
  padding: 14px;
  color: #dce7e8;
  background: #111619;
  font:
    13px/1.5 ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
}
.remote-surface-toolbar {
  display: flex;
  gap: 5px;
  padding: 5px 10px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.remote-surface-toolbar .remote-button {
  font-size: 0.78rem;
  padding: 5px 9px;
}
.remote-browser-scroll {
  display: block;
  background: var(--surface-2);
}
.remote-browser {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-select: none;
}
.remote-browser.remote-interactive {
  touch-action: none;
  cursor: pointer;
}
.remote-controls {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  padding: 12px 16px 0;
  border-top: 1px solid var(--line);
}
.remote-editor {
  min-width: 0;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  font-size: 16px;
  resize: vertical;
}
textarea.remote-editor {
  max-height: 220px;
  min-height: 68px;
}
.remote-editor:focus-visible {
  outline: 3px solid #78a98a;
  outline-offset: 1px;
}
.remote-editor:disabled {
  background: var(--surface-2);
}
.remote-button,
.remote-key {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 13px;
  min-height: 44px;
  font: inherit;
  font-size: 0.88rem;
  white-space: nowrap;
}
.remote-button:hover,
.remote-key:hover {
  background: var(--surface-2);
}
.remote-button:active,
.remote-key:active {
  background: var(--accent-soft);
}
.remote-button:disabled,
.remote-key:disabled {
  opacity: 0.5;
  cursor: default;
}
.remote-primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.remote-primary:hover {
  background: var(--accent-hover);
}
.remote-type-row {
  width: 100%;
}
.remote-type-row .remote-editor {
  flex: 1;
}
.remote-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  width: 100%;
}
.remote-key {
  min-width: 44px;
  padding: 7px 11px;
}
.remote-type-hint {
  display: block;
  font-size: 0.75rem;
  width: 100%;
}
.remote-feedback {
  margin: 8px 16px 0;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}
.remote-feedback:empty {
  display: none;
}
.remote-access-hint {
  flex-shrink: 0;
  margin: 0;
  padding: 10px 16px;
  color: var(--muted);
  font-size: 0.76rem;
}
.remote-mobile-picker {
  display: none;
}
@media (max-width: 760px) {
  .remote-viewer {
    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));
  }
  .remote-heading {
    align-items: flex-start;
    margin-bottom: 12px;
  }
  .remote-identity h1 {
    font-size: 1.25rem;
  }
  .remote-heading > .remote-button {
    padding: 8px 10px;
  }
  .remote-layout {
    grid-template-columns: minmax(0, 1fr);
    min-height: 510px;
    height: calc(
      100dvh - 116px - env(safe-area-inset-top) - env(safe-area-inset-bottom)
    );
    border-radius: 11px;
  }
  .remote-navigation {
    display: none;
  }
  .remote-mobile-picker {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    font-size: 0.84rem;
    border-bottom: 1px solid var(--line);
  }
  .remote-mobile-picker select {
    min-width: 0;
    flex: 1;
    min-height: 44px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: var(--surface);
    font-size: 16px;
  }
  .remote-pane-heading {
    min-height: 48px;
    padding: 10px 12px;
    gap: 5px 10px;
  }
  .remote-chat-scroll {
    padding: 14px;
  }
  .remote-controls {
    padding: 10px 10px 0;
  }
  .remote-key {
    flex: 1 0 44px;
  }
  .remote-type-hint {
    display: none;
  }
  .remote-access-hint {
    padding: 9px 10px max(9px, env(safe-area-inset-bottom));
  }
  .remote-feedback {
    margin-inline: 10px;
  }
}
@media (max-width: 760px) and (max-height: 640px) {
  .remote-layout {
    min-height: 400px;
  }
  textarea.remote-editor {
    min-height: 54px;
    max-height: 100px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .remote-viewer * {
    scroll-behavior: auto;
  }
}
@media (prefers-color-scheme: dark) {
  .remote-primary {
    color: #163121;
  }
}
