body {
  margin: 0;
  overflow: hidden;
  font-family: Arial, sans-serif;
  background: #87ceeb;
}

canvas {
  display: block;
}

.loading-panel {
  position: fixed;
  left: 20px;
  top: 20px;
  z-index: 30;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.78);
  color: white;
  font-size: 14px;
  font-weight: bold;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(6px);
}

.loading-panel.error {
  background: rgba(160, 0, 0, 0.82);
}

.music-notice {
  position: fixed;
  left: 20px;
  bottom: 24px;
  z-index: 35;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.music-notice.hidden {
  display: none;
}

.tips-panel {
  display: none;
}

.tips-panel p {
  display: none;
}

/* =========================
   对话框区域：屏幕正中间
   ========================= */

.dialog-box {
  position: fixed;
  left: 50%;
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
  z-index: 40;
  width: min(620px, calc(100vw - 56px));
  max-height: calc(100vh - 120px);
  pointer-events: none;
}

.dialog-box.hidden {
  display: none;
}

.dialog-content {
  pointer-events: auto;
  background: rgba(20, 18, 18, 0.88);
  color: #fff;
  border: 2px solid rgba(180, 30, 30, 0.9);
  border-radius: 14px;
  padding: 16px 18px 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.dialog-title {
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: bold;
  color: #ffb3b3;
}

.dialog-content p {
  margin: 0;
  line-height: 1.65;
  font-size: 14px;
  letter-spacing: 0.5px;
}

.dialog-line {
  margin-bottom: 10px;
}

.dialog-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.dialog-option-btn {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 179, 179, 0.5);
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(80, 20, 20, 0.8);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.45;
}

.dialog-option-btn:hover {
  background: rgba(130, 30, 30, 0.9);
}

/* 手势停留高亮：现在关闭按钮也支持 */
.dialog-option-btn.gesture-hover,
.dialog-next-btn.gesture-hover,
.baozang-retry-btn.gesture-hover,
.dialog-close-btn.gesture-hover {
  outline: 3px solid #fff200;
  background: rgba(170, 40, 40, 0.96);
}

.dialog-option-btn.gesture-selected,
.dialog-next-btn.gesture-selected,
.baozang-retry-btn.gesture-selected,
.dialog-close-btn.gesture-selected {
  outline: 4px solid #00ff99;
}

.dialog-reply {
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 3px solid rgba(255, 179, 179, 0.8);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #ffd6d6;
}

.dialog-reply.hidden {
  display: none;
}

.dialog-close-btn {
  margin-top: 10px;
  border: none;
  padding: 7px 14px;
  border-radius: 999px;
  background: #8b1e1e;
  color: white;
  cursor: pointer;
  font-size: 13px;
}

.dialog-close-btn:hover {
  background: #b52b2b;
}

.mvp-result-screen {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 999;
  width: 100vw;
  height: 100vh;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mvp-result-screen.hidden {
  display: none;
}

.mvp-result-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vr-control {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
}

.vr-button {
  border: none;
  padding: 14px 20px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}

.vr-button:hover {
  background: rgba(40, 40, 40, 0.92);
}

/* =========================
   手势控制区域
   ========================= */

#gestureVideo {
  position: fixed;
  left: 20px;
  bottom: 90px;
  z-index: 22;
  width: 180px;
  height: 135px;
  object-fit: cover;
  border-radius: 14px;
  background: #000;
  transform: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

#gestureVideo.mirror-camera {
  transform: scaleX(-1);
}

.gesture-control {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 25;
}

.gesture-button {
  border: none;
  padding: 14px 20px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}

.gesture-button:hover {
  background: rgba(40, 40, 40, 0.92);
}

.gesture-button:disabled {
  opacity: 0.72;
  cursor: default;
}

.gesture-status {
  position: fixed;
  left: 24px;
  bottom: 238px;
  z-index: 25;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 13px;
  font-weight: bold;
  pointer-events: none;
}

.gesture-cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff200;
  border: 3px solid #000;
  box-shadow: 0 0 18px rgba(255, 242, 0, 0.95);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.gesture-cursor.hidden {
  display: none;
}

/* =========================
   手机端适配
   ========================= */

@media (max-width: 768px) {
  #gestureVideo {
    left: 12px;
    bottom: 84px;
    width: 132px;
    height: 99px;
    border-radius: 10px;
  }

  .gesture-control {
    left: 12px;
    bottom: 18px;
  }

  .gesture-button,
  .vr-button {
    padding: 12px 16px;
    font-size: 13px;
  }

  .gesture-status {
    left: 12px;
    bottom: 192px;
    max-width: calc(100vw - 24px);
    font-size: 12px;
  }

  .dialog-box {
    width: min(560px, calc(100vw - 36px));
    max-height: calc(100vh - 72px);
  }

  .dialog-content {
    max-height: calc(100vh - 88px);
    padding: 13px 14px 12px;
  }
}


/* =========================
   手机 VR 双屏模式适配
   =========================
   进入 A-Frame VR 后，3D 场景、3D 对话框、3D 黄色手势点、3D MVP 结算图
   会由 WebGL/A-Frame 自动左右眼双屏渲染。
   下面这些普通 HTML 层如果继续显示，会变成单屏覆盖，所以在 VR 模式隐藏。
*/
body.vr-stereo-active .dialog-box,
body.vr-stereo-active .mvp-result-screen,
body.vr-stereo-active #gestureCursor,
body.vr-stereo-active #gestureVideo,
body.vr-stereo-active .gesture-control,
body.vr-stereo-active .gesture-status,
body.vr-stereo-active .music-notice,
body.vr-stereo-active .loading-panel,
body.vr-stereo-active .vr-control {
  display: none !important;
}
