* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

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

#app {
  width: 100%;
  height: 100%;
  position: relative;
}

#viewer-container {
  width: 100%;
  height: 100%;
}

/* 加载遮罩 */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-content {
  text-align: center;
  color: #fff;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #4ecdc4;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

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

.loading-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
}

/* 顶部标题栏 */
.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}

.title-wrap {
  flex: 1;
  pointer-events: auto;
}

.work-title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  margin-bottom: 4px;
}

.work-desc {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  transition: all 0.3s;
}

.icon-btn:hover {
  background: rgba(255,255,255,0.25);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* 场景列表面板 */
.scene-panel {
  position: absolute;
  top: 0;
  right: -300px;
  width: 280px;
  height: 100%;
  background: rgba(20, 20, 20, 0.95);
  backdrop-filter: blur(20px);
  z-index: 200;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}

.scene-panel.active {
  right: 0;
}

.scene-panel-header {
  padding: 16px 20px;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.close-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scene-panel-search {
  position: relative;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.scene-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 30px 8px 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

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

.scene-search-input:focus {
  border-color: rgba(78, 205, 196, 0.5);
  background: rgba(255,255,255,0.12);
}

.scene-search-clear {
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 20px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scene-search-clear:hover {
  background: rgba(255,255,255,0.25);
}

.scene-empty {
  color: rgba(255,255,255,0.4);
  font-size: 13px;
  text-align: center;
  padding: 40px 0;
}

.scene-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.scene-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 8px;
}

.scene-item:hover {
  background: rgba(255,255,255,0.08);
}

.scene-item.active {
  background: rgba(78, 205, 196, 0.2);
}

.scene-thumb {
  width: 60px;
  height: 40px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.scene-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scene-name {
  color: #fff;
  font-size: 14px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 底部控制栏 */
.bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 20px 24px;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.scene-name-mobile {
  color: #fff;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.scene-dot {
  width: 8px;
  height: 8px;
  background: #4ecdc4;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

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

.control-btns {
  display: flex;
  gap: 12px;
  pointer-events: auto;
}

.ctrl-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.ctrl-btn:hover {
  background: rgba(255,255,255,0.25);
}

.ctrl-btn.active {
  background: #4ecdc4;
  color: #fff;
}

.ctrl-btn svg {
  width: 20px;
  height: 20px;
}

/* 漫游视频按钮 */
.walkthrough-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 16px;
  border: none;
  background: rgba(78,205,196,0.9);
  backdrop-filter: blur(10px);
  border-radius: 22px;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

.walkthrough-btn:hover {
  background: #4ecdc4;
  transform: translateY(-1px);
}

.walkthrough-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ============ 小地图按钮 ============ */
.minimap-btn {
  position: absolute;
  top: 80px;
  right: 16px;
  width: 110px;
  height: 110px;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
  border: 2px solid rgba(255,255,255,.35);
  z-index: 20;
  background: #111;
  transition: transform .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.minimap-btn:hover { transform: scale(1.05); }
.minimap-inner {
  position: relative;
  display: inline-block;
  line-height: 0; /* 消除 img 下的基线间隙，让标记层与图片对齐 */
}
/* 缩略图按 contain 完整显示，避免 cover 裁切导致标记点位置偏移 */
.minimap-btn .minimap-inner img {
  display: block;
  width: auto; height: auto;
  max-width: 106px; max-height: 106px;
  object-fit: contain;
}

/* ============ 大地图弹窗 ============ */
.map-popup .popup-mask { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 90; }
.map-popup-content {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 88vw; max-width: 900px;
  max-height: 88vh;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  z-index: 100;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.map-popup-content .popup-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid #eee;
  font-weight: 600; font-size: 15px;
}
.map-popup-content .popup-close {
  background: none; border: none; font-size: 22px; cursor: pointer; color: #888;
  width: 32px; height: 32px;
}
.map-area {
  position: relative;
  flex: 1;
  background: #f5f5f5;
  display: flex; align-items: center; justify-content: center;
  overflow: auto;
  padding: 12px;
}
.map-stage {
  position: relative;
  max-width: 100%;
  max-height: 68vh;
  display: inline-block;
  line-height: 0; /* 消除 img 下的基线间隙 */
}
.map-area .map-image {
  max-width: 100%;
  max-height: 68vh;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  display: block;
}
.map-stage > .map-marker {
  position: absolute;
  pointer-events: auto;
  cursor: pointer;
  transform: translate(-50%, -100%);
  transition: transform .12s;
}
.map-marker:hover { transform: translate(-50%, -100%) scale(1.15); }
.marker-dot {
  display: block;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
  margin: 0 auto 2px;
}
.marker-scene .marker-dot { background: #409eff; }
.marker-hotspot .marker-dot { background: #e6a23c; }
.marker-switch .marker-dot { background: #67c23a; }
.marker-current .marker-dot { background: #f56c6c; width: 18px; height: 18px; animation: pulse 1.4s infinite; }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(245,108,108,.6); }
  50% { box-shadow: 0 0 0 8px rgba(245,108,108,0); }
}
.marker-label {
  font-size: 11px;
  background: rgba(0,0,0,.7);
  color: #fff;
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
  display: inline-block;
  margin-top: 1px;
}

/* ============ 当前位置 & 朝向（小地图 / 大地图通用） ============ */
/* 定位点：以 left/top 百分比锚定在平面图坐标上（宽高为 0，子元素以负 margin 居中到该点） */
.view-point {
  position: absolute;
  width: 0; height: 0;
  pointer-events: none;
  z-index: 6;
}
.view-cone,
.view-dot {
  position: absolute;
  left: 0; top: 0;
  border-radius: 50%;
  pointer-events: none;
}
/* 朝向扇形：默认朝上（0deg），由内联 transform: rotate() 旋转 */
.view-cone {
  background: conic-gradient(from -32deg, rgba(255,107,53,.6) 0deg 64deg, rgba(255,107,53,0) 64deg);
}
/* 当前位置点 */
.view-dot {
  background: #ff6b35;
  border: 1.5px solid #fff;
  box-shadow: 0 0 4px rgba(0,0,0,.55);
}
/* 小地图缩略图上的尺寸 */
.minimap-inner .view-cone { width: 30px; height: 30px; margin: -15px 0 0 -15px; }
.minimap-inner .view-dot  { width: 7px;  height: 7px;  margin: -3.5px 0 0 -3.5px; }
/* 大地图上的尺寸 */
.map-stage .view-cone { width: 68px; height: 68px; margin: -34px 0 0 -34px; }
.map-stage .view-dot  { width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; border-width: 2px; }

.map-legend {
  padding: 10px 16px;
  border-top: 1px solid #eee;
  background: #fafafa;
  display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: #555;
}
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-item .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 1px solid #fff; box-shadow: 0 0 0 1px #ccc; }
.legend-item .dot-scene { background: #409eff; }
.legend-item .dot-current { background: #f56c6c; }
.legend-item .dot-hotspot { background: #e6a23c; }
.legend-item .dot-switch { background: #67c23a; }
.legend-item .cone-mark {
  width: 12px; height: 12px; border-radius: 50%; display: inline-block;
  background: conic-gradient(from -32deg, #ff6b35 0deg 64deg, #e0e0e0 64deg);
  border: 1px solid #fff; box-shadow: 0 0 0 1px #ccc;
}

/* 信息热点弹窗 */
.info-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.info-popup.show {
  display: flex;
}

.popup-mask {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
}

.popup-content {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  max-height: 70vh;
  overflow-y: auto;
  animation: popupIn 0.3s ease;
}

@keyframes popupIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: #f5f5f5;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
}

.popup-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
  padding-right: 40px;
}

.popup-body {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
}

/* 漫游视频弹窗 */
.video-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 600;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.video-popup.show {
  display: flex;
}

.video-popup-content {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
  max-width: 900px;
  animation: popupIn 0.3s ease;
}

.video-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 14px;
}

.video-popup-head .popup-close {
  position: static;
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 18px;
}

.video-popup-content video {
  display: block;
  width: 100%;
  max-height: 75vh;
  background: #000;
}

.popup-body img {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 10px;
}

/* 陀螺仪授权提示 */
.gyro-prompt {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.gyro-prompt-content {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  max-width: 300px;
  width: 100%;
  text-align: center;
}

.gyro-prompt-content p {
  font-size: 16px;
  color: #333;
  margin-bottom: 20px;
}

.gyro-btns {
  display: flex;
  gap: 12px;
}

.gyro-btns button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  background: #f5f5f5;
  color: #666;
}

.gyro-btns button.primary {
  background: #4ecdc4;
  color: #fff;
}

/* 热点样式覆盖 */
.psv-hotspot {
  cursor: pointer;
  transition: transform 0.2s;
}

.psv-hotspot:hover {
  transform: scale(1.2);
}

/* 响应式适配 */
@media (min-width: 768px) {
  .top-bar {
    padding: 20px 30px;
  }

  .work-title {
    font-size: 22px;
  }

  .work-desc {
    font-size: 14px;
  }

  .bottom-bar {
    padding: 16px 30px 30px;
  }

  .ctrl-btn {
    width: 48px;
    height: 48px;
  }

  .ctrl-btn svg {
    width: 22px;
    height: 22px;
  }
}

/* 嵌入模式（小程序webview等） */
.embed-mode .top-bar,
.embed-mode .bottom-bar .scene-name-mobile {
  display: none;
}

.embed-mode .bottom-bar {
  padding-bottom: 16px;
}
