* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* VR场景 - 全屏显示 */
#vr-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
}

/* 摄像头预览 - 小窗口叠加 */
#video-container {
  position: fixed;
  top: 10px;
  right: 10px;
  width: 160px;
  height: 120px;
  z-index: 999;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
  background: #1a1a1a;
  border: 3px solid #4CC3D9;
}

#videoElement {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  opacity: 0.3;
}

#outputCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: scaleX(-1);
  background: transparent;
}

/* 信息面板 */
#info-panel {
  position: fixed;
  bottom: 20px;
  left: 10px;
  z-index: 50;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.6;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#status {
  font-weight: 600;
  color: #4CC3D9;
}

#hand-position {
  color: #aaa;
}

#interaction-status {
  color: #FF6B6B;
  font-weight: 600;
}

/* 启动按钮 */
#start-btn {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  background: linear-gradient(135deg, #4CC3D9, #2AA4B9);
  color: #fff;
  border: none;
  padding: 16px 32px;
  font-size: 18px;
  font-weight: 600;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(76, 195, 217, 0.4);
  transition: all 0.3s ease;
}

#start-btn:hover {
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: 0 6px 25px rgba(76, 195, 217, 0.6);
}

#start-btn:active {
  transform: translate(-50%, -50%) scale(0.98);
}

#start-btn:disabled {
  background: #666;
  cursor: not-allowed;
  box-shadow: none;
}

/* 自定义VR按钮 */
.vr-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  background: linear-gradient(135deg, #FF6B6B, #FF8E53);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.vr-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

.vr-btn:active {
  transform: scale(0.98);
}

.vr-btn.exit-btn {
  background: linear-gradient(135deg, #666, #444);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.vr-icon {
  font-size: 18px;
}

.vr-text {
  font-size: 14px;
}

/* 隐藏默认的A-Frame VR按钮和提示 */
.a-enter-vr-button,
.a-vr-mode-ui,
.a-webvr-ui,
.a-device-orientation-permission-ui,
.a-vr-not-supported-ui {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

/* 确保A-Frame的canvas不被覆盖 */
canvas.a-canvas {
  z-index: 10 !important;
}

/* 模式切换按钮 */
#mode-buttons {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  gap: 12px;
}

.mode-btn {
  background: linear-gradient(135deg, #666, #444);
  color: #fff;
  border: 2px solid transparent;
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.mode-btn.active {
  background: linear-gradient(135deg, #4CC3D9, #2AA4B9);
  border-color: #fff;
  box-shadow: 0 4px 20px rgba(76, 195, 217, 0.4);
}

.mode-icon {
  font-size: 16px;
}

.mode-text {
  font-size: 13px;
}

/* 隐藏元素的类 */
.hidden {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

/* A-Frame场景样式 */
a-scene {
  position: absolute;
  width: 100%;
  height: 100%;
}

/* 立方体高亮效果 */
#targetCube {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

/* 交互指示器 */
#interaction-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 40;
  width: 150px;
  height: 150px;
  border: 3px dashed rgba(76, 195, 217, 0.5);
  border-radius: 50%;
  pointer-events: none;
  display: none;
}

#interaction-indicator.active {
  display: block;
  border-color: #4CC3D9;
  animation: rotate 2s linear infinite;
}

@keyframes rotate {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* 移动端样式 */
@media only screen and (max-width: 768px) {
  #video-container {
    width: 100px;
    height: 75px;
    top: 5px;
    right: 5px;
  }
  
  #info-panel {
    bottom: 130px;
    left: 5px;
    padding: 6px 10px;
    font-size: 10px;
  }
  
  #start-btn {
    padding: 12px 24px;
    font-size: 16px;
  }
  
  #interaction-indicator {
    width: 100px;
    height: 100px;
  }
  
  .vr-btn {
    bottom: 10px;
    right: 10px;
    padding: 10px 16px;
    font-size: 12px;
  }
  
  #mode-buttons {
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: row;
    gap: 8px;
  }
  
  .mode-btn {
    padding: 8px 16px;
    font-size: 12px;
  }
  
  .mode-icon {
    font-size: 14px;
  }
  
  .mode-text {
    font-size: 11px;
  }
}

@media only screen and (orientation: landscape) and (max-width: 900px) {
  #video-container {
    width: 80px;
    height: 60px;
  }
  
  #info-panel {
    bottom: 5px;
    left: 5px;
  }
}