/* ============================================
   MOBILE TELEOP CSS
   Styling for MobileTeleopView component
   Uses remote-teleop-device from Transitive Robotics
   ============================================ */

/* Page-level touch settings for multi-touch support */
.mobile-teleop-landscape,
.mobile-teleop-portrait {
  touch-action: pan-x pan-y;
  -webkit-user-select: none;
  user-select: none;
}

/* Prevent pull-to-refresh and other gestures that interfere */
body.teleop-fullscreen {
  overscroll-behavior: none;
  touch-action: none;
}

/* Chrome Android Warning Banner */
.chrome-warning-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #000;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.chrome-warning-banner button {
  background: rgba(0,0,0,0.2);
  border: none;
  color: #000;
  font-size: 16px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
}

/* ============================================
   LANDSCAPE MODE - Fullscreen video with overlay joysticks
   ============================================ */

body.teleop-fullscreen {
  overflow: hidden !important;
}

body.teleop-fullscreen .mobile-header,
body.teleop-fullscreen .mobile-bottom-nav,
body.teleop-fullscreen header,
body.teleop-fullscreen nav {
  display: none !important;
}

.mobile-teleop-landscape {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000;
  z-index: 1000;
  overflow: hidden;
}

/* Video shell - landscape fills screen */
.teleop-video-shell--landscape {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.teleop-video-shell--landscape remote-teleop-device {
  width: 100%;
  height: 100%;
  display: block;
}

/* HUD Overlay - telemetry on top of video */
.hud-overlay {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 100;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 90%;
}

.hud-tag {
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: white;
  font-family: 'SF Mono', Monaco, monospace;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}

.hud-tag.mode-disabled { color: #9ca3af; }
.hud-tag.mode-standby { color: #fbbf24; }
.hud-tag.mode-teleop { color: #34d399; }
.hud-tag.mode-auto { color: #60a5fa; }
.hud-tag.on { color: #4ade80; }
.hud-tag.off { color: #f87171; }
.hud-tag.warn { color: #fbbf24; }

/* HUD Alerts */
.hud-alert {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: bold;
  z-index: 150;
  animation: pulse-alert 1s infinite;
}

.hud-alert.emergency {
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: 2px solid #fee2e2;
}

.hud-alert.fault {
  background: rgba(245, 158, 11, 0.9);
  color: white;
  border: 2px solid #fef3c7;
}

@keyframes pulse-alert {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Recording indicator */
.hud-recording {
  position: absolute;
  top: 10px;
  right: 60px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(239, 68, 68, 0.9);
  border-radius: 4px;
  color: white;
  font-size: 12px;
  font-weight: bold;
  z-index: 100;
}

.recording-dot {
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Landscape menu button */
.landscape-menu-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

/* Controls menu overlay */
.controls-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.controls-menu {
  background: #1a1a2e;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.controls-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.controls-menu-header h3 {
  margin: 0;
  font-size: 18px;
  color: white;
}

.controls-menu-header button {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}

.control-section {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 10px;
}

.engine-status, .feeder-status {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 10px;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-dot.running { background: #4ade80; }
.status-dot.stopped { background: #f87171; }

.button-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.control-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transition: background 0.2s;
}

.control-btn:active { background: rgba(255, 255, 255, 0.2); }
.control-btn.active { background: #3b82f6; }
.control-btn.start { background: #059669; }
.control-btn.stop { background: #dc2626; }
.control-btn.disabled { opacity: 0.5; }
.control-btn.recording { background: #dc2626; animation: pulse-alert 1s infinite; }
.control-btn.full-width { width: 100%; }

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

.mode-btn {
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: transparent;
  color: white;
  font-size: 12px;
  cursor: pointer;
}

.mode-btn.active {
  background: #3b82f6;
  border-color: #3b82f6;
}

.route-input {
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: white;
  font-size: 14px;
  margin-bottom: 10px;
  box-sizing: border-box;
}

.route-input::placeholder { color: rgba(255, 255, 255, 0.4); }

/* ============================================
   PORTRAIT MODE
   ============================================ */

.mobile-teleop-portrait {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 64px);
  background: #1a1a1a;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}

/* Feeder top bar */
.feeder-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.feeder-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.feeder-status {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.feeder-motor-active {
  font-size: 12px;
  font-weight: 600;
  color: #6ee7b7;
  animation: pulse-alert 1.5s infinite;
}

.feeder-bar-buttons {
  display: flex;
  gap: 8px;
}

.feeder-btn {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transition: all 0.2s;
}

.feeder-btn:active { transform: scale(0.95); }
.feeder-btn.active { background: #3b82f6; }
.feeder-btn.motor.active { background: #059669; }
.feeder-btn.cam.active { background: #8b5cf6; }

/* Portrait video wrapper */
.portrait-video-wrapper {
  position: relative;
  width: 100%;
  flex-shrink: 0;
  background: #000;
  overflow: visible; /* Allow joysticks to extend beyond */
}

.teleop-video-shell--portrait {
  position: relative;
  width: 100%;
  display: block;
  background: #000;
}

.teleop-video-shell--portrait remote-teleop-device {
  width: 100%;
  display: block;
}

/* Force the Transitive internal layout to be vertical in portrait */
.teleop-video-shell--portrait remote-teleop-device .transitive-bs-root,
.teleop-video-shell--portrait remote-teleop-device > div:first-child {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
}

/* Video wrapper should not be absolute */
.teleop-video-shell--portrait remote-teleop-device .webrtc-video-wrapper {
  position: relative !important;
  width: 100% !important;
  flex-shrink: 0 !important;
}

.video-overlay-info {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

.mode-badge {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  background: rgba(0,0,0,0.6);
  color: white;
}

.mode-badge.mode-disabled { background: rgba(107, 114, 128, 0.8); }
.mode-badge.mode-standby { background: rgba(245, 158, 11, 0.8); }
.mode-badge.mode-teleop { background: rgba(16, 185, 129, 0.8); }
.mode-badge.mode-auto { background: rgba(59, 130, 246, 0.8); }

.conn-badge {
  font-size: 18px;
}

.conn-badge.on { color: #4ade80; }
.conn-badge.off { color: #f87171; }

/* Portrait controls section */
.portrait-controls {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.control-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
}

.status-indicator {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}

.status-indicator.on { background: rgba(74, 222, 128, 0.2); color: #4ade80; }
.status-indicator.off { background: rgba(248, 113, 113, 0.2); color: #f87171; }

.card-buttons {
  display: flex;
  gap: 8px;
}

.card-buttons.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.btn-engine, .btn-mode, .btn-action, .btn-record {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-engine {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.btn-engine.start { background: #059669; }
.btn-engine.stop { background: #dc2626; }
.btn-engine.disabled { opacity: 0.4; }

.btn-mode {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-mode.active {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.btn-action {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.btn-action.active { background: #3b82f6; }

.btn-record {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  margin-top: 8px;
}

.btn-record.recording {
  background: #dc2626;
  animation: pulse-alert 1s infinite;
}

.recording-badge {
  color: #f87171;
  font-size: 11px;
  animation: blink 1s infinite;
}

.route-name-input {
  width: 100%;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: white;
  font-size: 14px;
  box-sizing: border-box;
}

.route-name-input::placeholder { color: rgba(255, 255, 255, 0.4); }

/* Portrait telemetry */
.portrait-telemetry {
  display: flex;
  justify-content: space-between;
  flex-wrap: nowrap; /* Force single line */
  gap: 4px;
  width: 100%;
}

.telem-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0; /* Allow shrinking */
  flex: 1;
}

.telem-value {
  font-size: 13px;
  font-weight: bold;
  color: white;
  font-family: 'SF Mono', Monaco, monospace;
  white-space: nowrap;
}

.telem-value.good { color: #4ade80; }
.telem-value.warn { color: #fbbf24; }

.telem-label {
  font-size: 8px;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* ============================================
   SLIDE-OUT PANEL
   ============================================ */

.teleop-panel-toggle {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 60px;
  background: rgba(59, 130, 246, 0.9);
  border: none;
  border-radius: 8px 0 0 8px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  cursor: pointer;
  transition: right 0.3s ease;
}

.teleop-panel-toggle.open { right: 260px; }

.teleop-controls-panel {
  position: fixed;
  top: 0;
  right: -260px;
  width: 260px;
  height: 100%;
  background: #1a1a2e;
  z-index: 1050;
  transition: right 0.3s ease;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
  overflow-y: auto;
  padding-bottom: 100px;
}

.teleop-controls-panel.open { right: 0; }

.teleop-controls-panel .panel-content { padding: 16px; }

.teleop-controls-panel .panel-title {
  font-size: 16px;
  font-weight: 600;
  color: white;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-section { margin-bottom: 18px; }

.panel-section .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

.panel-section .status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.panel-section .status-dot.on { background: #4ade80; }
.panel-section .status-dot.off { background: #6b7280; }

.panel-section .value-display {
  font-family: 'SF Mono', Monaco, monospace;
  color: #60a5fa;
}

.panel-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  margin-bottom: 8px;
  transition: background 0.2s;
}

.panel-btn:active { background: rgba(255, 255, 255, 0.2); }
.panel-btn.active { background: #3b82f6; }
.panel-btn.start { background: #059669; }
.panel-btn.stop { background: #dc2626; }
.panel-btn.disabled { opacity: 0.5; }
.panel-btn.full { width: 100%; }
.panel-btn.danger { background: #dc2626; }

.panel-section .button-row {
  display: flex;
  gap: 8px;
}

.panel-section .button-row .panel-btn {
  flex: 1;
  margin-bottom: 0;
}

.throttle-slider {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  outline: none;
  margin-bottom: 10px;
}

.throttle-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: #3b82f6;
  border-radius: 50%;
  cursor: pointer;
}

.preset-row {
  display: flex;
  gap: 6px;
}

.preset-btn {
  flex: 1;
  padding: 6px 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  cursor: pointer;
}

.preset-btn:active { background: rgba(255, 255, 255, 0.1); }

/* ============================================
   FEED VIEW CAMERA (draggable overlay)
   ============================================ */

.teleop-feed-camera {
  position: fixed;
  width: 200px;
  height: 130px;
  background: #000;
  border: 2px solid #fbbf24;
  border-radius: 8px;
  overflow: hidden;
  z-index: 600;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.feed-camera-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  background: rgba(251, 191, 36, 0.9);
  font-size: 10px;
  font-weight: bold;
  color: #000;
  cursor: move;
}

.feed-camera-header button {
  background: none;
  border: none;
  color: #000;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
}

.teleop-feed-camera webrtc-video-device {
  width: 100%;
  height: calc(100% - 24px);
  display: block;
}

/* ============================================
   TRANSITIVE REMOTE-TELEOP-DEVICE STYLING
   Based on actual DOM structure:
   - .transitive-bs-root
   - .remote-teleop-wrapper
   - .webrtc-video-wrapper > video.webrtc-video0
   - .remote-teleop-joystick > .form-check.form-switch
   ============================================ */

/* Base component styling */
remote-teleop-device {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
}

/* Main wrapper */
remote-teleop-device .transitive-bs-root {
  width: 100% !important;
  height: 100% !important;
  background: transparent !important;
}

/* Remote teleop wrapper - contains video + joystick areas */
remote-teleop-device .remote-teleop-wrapper {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  height: 100% !important;
}

/* Video wrapper */
remote-teleop-device .webrtc-video-wrapper {
  position: relative !important;
  width: 100% !important;
  flex: 1 !important;
  min-height: 0 !important;
}

remote-teleop-device video,
remote-teleop-device .webrtc-video0 {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  background: #000 !important;
}

/* Hide the "connected" badge */
remote-teleop-device .badge {
  display: none !important;
}

/* ============================================
   JOYSTICK SECTION STYLING
   ============================================ */

/* The joystick container */
remote-teleop-device .remote-teleop-joystick {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  padding: 15px 20px !important;
  background: #1e293b !important; /* Dark blue */
  width: 100% !important;
  max-width: 100% !important;
  max-height: none !important;
  touch-action: none !important;
}

/* HIDE extra controller buttons and labels */
remote-teleop-device .remote-teleop-joystick button,
remote-teleop-device .remote-teleop-joystick .btn,
remote-teleop-device .remote-teleop-joystick [class*="button"],
remote-teleop-device .remote-teleop-joystick input:not(.form-check-input),
remote-teleop-device .remote-teleop-joystick select {
  display: none !important;
}

/* AGGRESSIVELY hide "no gamepad detected" and ALL text */
remote-teleop-device .remote-teleop-joystick > span,
remote-teleop-device .remote-teleop-joystick > label,
remote-teleop-device .remote-teleop-joystick > p,
remote-teleop-device .remote-teleop-joystick > div > span,
remote-teleop-device .remote-teleop-joystick > div > label,
remote-teleop-device .remote-teleop-joystick > div > p,
remote-teleop-device .remote-teleop-joystick [class*="gamepad"],
remote-teleop-device .remote-teleop-joystick [class*="status"],
remote-teleop-device .remote-teleop-joystick [class*="text"],
remote-teleop-device .remote-teleop-joystick [class*="label"]:not(.form-check-label),
remote-teleop-device .remote-teleop-joystick [class*="message"],
remote-teleop-device .remote-teleop-joystick [class*="info"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

/* Hide any loose text nodes by making font size 0 on container */
remote-teleop-device .remote-teleop-joystick {
  font-size: 0 !important;
  color: transparent !important;
}

/* The enable toggle - clean minimal style */
remote-teleop-device .form-check,
remote-teleop-device .form-switch {
  display: inline-flex !important;
  align-items: center !important;
  margin-bottom: 12px !important;
  margin-left: 15px !important;
  padding: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none !important;
}

/* Override any Bootstrap styles */
remote-teleop-device .form-check.form-switch,
remote-teleop-device div.form-check,
remote-teleop-device div.form-switch {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

remote-teleop-device .form-check-input {
  width: 44px !important;
  height: 24px !important;
  cursor: pointer !important;
  background-color: rgba(255,255,255,0.25) !important;
  border: none !important;
  border-radius: 12px !important;
  margin: 0 !important;
  box-shadow: none !important;
  outline: none !important;
}

remote-teleop-device .form-check-input:checked {
  background-color: #3b82f6 !important;
}

remote-teleop-device .form-check-input:focus {
  box-shadow: none !important;
  outline: none !important;
}

/* HIDE the toggle label */
remote-teleop-device .form-check-label {
  display: none !important;
}

/* ============================================
   JOYSTICK CANVAS STYLING - BRIGHT AND VISIBLE
   ============================================ */

/* Joystick canvases - BRIGHT amber/yellow for visibility */
remote-teleop-device .remote-teleop-joystick canvas {
  width: 130px !important;
  height: 130px !important;
  min-width: 130px !important;
  min-height: 130px !important;
  touch-action: none !important;
  pointer-events: auto !important;
  border-radius: 50% !important;
  background: rgba(251, 191, 36, 0.3) !important;
  border: 4px solid #fbbf24 !important;
  box-shadow: 0 0 25px rgba(251, 191, 36, 0.6), 0 0 50px rgba(251, 191, 36, 0.3) !important;
  opacity: 1 !important;
  filter: brightness(1.2) !important;
}

/* Container for the two joysticks - positioned LEFT */
remote-teleop-device .remote-teleop-joystick > div:not(.form-check):not(.form-switch) {
  display: flex !important;
  justify-content: flex-start !important;
  align-items: center !important;
  width: 100% !important;
  gap: 40px !important;
  touch-action: none !important;
  margin-left: -14px !important;
  margin-right: auto !important;
}

/* Ensure multi-touch works - critical for dual joysticks */
remote-teleop-device,
remote-teleop-device .remote-teleop-joystick,
remote-teleop-device .remote-teleop-joystick > div,
remote-teleop-device .remote-teleop-joystick canvas {
  touch-action: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}

/* ============================================
   LANDSCAPE MODE OVERRIDES
   ============================================ */

.teleop-video-shell--landscape {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.teleop-video-shell--landscape remote-teleop-device {
  position: absolute;
  inset: 0;
}

.teleop-video-shell--landscape remote-teleop-device .remote-teleop-wrapper {
  position: relative !important;
  height: 100% !important;
}

.teleop-video-shell--landscape remote-teleop-device .webrtc-video-wrapper {
  position: absolute !important;
  inset: 0 !important;
}

/* Joysticks overlay at bottom in landscape */
.teleop-video-shell--landscape remote-teleop-device .remote-teleop-joystick {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  background: linear-gradient(transparent, #1e293b) !important; /* Dark blue gradient */
  padding: 30px !important;
  flex-direction: row !important;
  justify-content: flex-start !important;
  align-items: flex-end !important;
  gap: 60px !important;
}

.teleop-video-shell--landscape remote-teleop-device .form-check,
.teleop-video-shell--landscape remote-teleop-device .form-switch {
  position: absolute !important;
  top: -50px !important;
  left: 20px !important;
  transform: none !important;
  background: transparent !important;
  border: none !important;
}

.teleop-video-shell--landscape remote-teleop-device .remote-teleop-joystick canvas {
  width: 150px !important;
  height: 150px !important;
  min-width: 150px !important;
  min-height: 150px !important;
  background: rgba(251, 191, 36, 0.3) !important;
  border: 4px solid #fbbf24 !important;
  box-shadow: 0 0 30px rgba(251, 191, 36, 0.6), 0 0 60px rgba(251, 191, 36, 0.3) !important;
}

.teleop-video-shell--landscape remote-teleop-device .remote-teleop-joystick > div:not(.form-check):not(.form-switch) {
  width: auto !important;
  justify-content: flex-start !important;
  margin-left: 20px !important;
  gap: 60px !important;
}

/* ============================================
   PORTRAIT MODE OVERRIDES
   ============================================ */

.teleop-video-shell--portrait {
  position: relative;
  width: 100%;
  display: block;
  background: #000;
}

.teleop-video-shell--portrait remote-teleop-device {
  width: 100%;
  display: block;
}

.teleop-video-shell--portrait remote-teleop-device .remote-teleop-wrapper {
  flex-direction: column !important;
}

.teleop-video-shell--portrait remote-teleop-device .webrtc-video-wrapper {
  position: relative !important;
  flex: none !important;
  height: auto !important;
}

.teleop-video-shell--portrait remote-teleop-device video {
  width: 100% !important;
  height: auto !important;
  display: block !important;
}

/* Joysticks below video in portrait */
.teleop-video-shell--portrait remote-teleop-device .remote-teleop-joystick {
  position: relative !important;
  flex-shrink: 0 !important;
  background: #1e293b !important; /* Dark blue */
}

.teleop-video-shell--portrait remote-teleop-device .remote-teleop-joystick canvas {
  width: 130px !important;
  height: 130px !important;
  min-width: 130px !important;
  min-height: 130px !important;
  background: rgba(251, 191, 36, 0.3) !important;
  border: 4px solid #fbbf24 !important;
  box-shadow: 0 0 25px rgba(251, 191, 36, 0.6), 0 0 50px rgba(251, 191, 36, 0.3) !important;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-height: 600px) {
  .portrait-controls {
    padding: 8px;
    gap: 8px;
  }
  
  .control-card {
    padding: 10px;
  }
  
  .telem-value {
    font-size: 12px;
  }
}

@media (min-width: 768px) {
  .controls-menu {
    max-width: 500px;
  }
  
  .portrait-telemetry {
    justify-content: space-between;
  }
}