/* ============ 时代记忆 · 数字重建 线上展厅 ============ */
:root {
  --bg: #0b0e14;
  --panel: rgba(15, 18, 26, 0.78);
  --line: rgba(255, 255, 255, 0.14);
  --text: #ece7db;
  --text-dim: #9aa0ab;
  --accent: #d9a441;
  --accent-soft: #ffd98a;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

button { font-family: inherit; touch-action: manipulation; }

/* ---------- 画布与热点层 ---------- */
#pano-container {
  position: fixed; inset: 0;
  cursor: grab;
}
#pano-container:active { cursor: grabbing; }
#pano-container canvas { display: block; touch-action: none; }

#hotspot-layer {
  position: fixed; inset: 0;
  pointer-events: none;
  overflow: hidden;
}

/* ---------- 热点 ---------- */
.hs {
  position: absolute; left: 0; top: 0;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer;
  color: #fff;
  pointer-events: auto;
  transition: opacity 0.15s linear;
  will-change: transform;
}
.hs-icon {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  background: rgba(20, 24, 34, 0.66);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease;
}
.hs-icon svg { width: 24px; height: 24px; }
.hs:hover .hs-icon { transform: scale(1.12); }
.hs-label {
  font-size: 13px; line-height: 1;
  padding: 5px 11px; border-radius: 999px;
  background: rgba(10, 12, 18, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  white-space: nowrap;
  color: var(--text);
}

/* 导航热点（金色，带呼吸圈） */
.hs-nav .hs-icon {
  background: rgba(217, 164, 65, 0.92);
  border-color: #f4d489;
  color: #241a05;
  position: relative;
}
.hs-nav .hs-icon::after {
  content: ""; position: absolute; inset: -7px;
  border-radius: 50%; border: 2px solid rgba(217, 164, 65, 0.65);
  animation: hs-pulse 2.2s ease-out infinite;
}
@keyframes hs-pulse {
  0%   { transform: scale(0.75); opacity: 0.9; }
  70%  { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1.25); opacity: 0; }
}

/* 不同方向的箭头 = 不同颜色，观众一眼可辨 */
.hs-nav-back .hs-icon {
  background: rgba(96, 118, 160, 0.92);
  border-color: #b9c8e4;
}
.hs-nav-back .hs-icon::after { border-color: rgba(96, 118, 160, 0.6); }
.hs-nav-up .hs-icon,
.hs-nav-down .hs-icon {
  background: rgba(148, 112, 205, 0.92);
  border-color: #cfbdf2;
}
.hs-nav-up .hs-icon::after,
.hs-nav-down .hs-icon::after { border-color: rgba(148, 112, 205, 0.6); }
.hs-nav-door .hs-icon {
  background: rgba(72, 152, 142, 0.92);
  border-color: #a8e0d8;
}
.hs-nav-door .hs-icon::after { border-color: rgba(72, 152, 142, 0.6); }
.hs-nav-up .hs-icon svg,
.hs-nav-down .hs-icon svg,
.hs-nav-door .hs-icon svg { margin-top: 1px; }

/* 店铺热点 */
.hs-shop .hs-icon {
  background: rgba(28, 38, 62, 0.85);
  border-color: rgba(255, 217, 138, 0.55);
  color: var(--accent-soft);
}
.hs-shop:hover .hs-label {
  background: rgba(217, 164, 65, 0.9);
  color: #241a05;
}

/* 信息热点 */
.hs-info .hs-icon {
  background: rgba(30, 30, 34, 0.7);
  color: #cfd4dc;
}

/* ---------- 顶栏 ---------- */
#top-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px 10px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 14px;
  background: linear-gradient(rgba(8, 10, 15, 0.82), rgba(8, 10, 15, 0));
  pointer-events: none;
}
#top-bar .brand { pointer-events: auto; min-width: 0; }
#tour-title {
  font-size: 19px; font-weight: 700; letter-spacing: 2px;
  color: var(--accent-soft);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#scene-name {
  display: block;
  font-size: 12px; color: var(--text-dim); letter-spacing: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 56vw;
}
.top-actions { display: flex; gap: 8px; pointer-events: auto; flex-shrink: 0; }

.chip {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  padding: 7px 14px; border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.15s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent-soft); }
.chip.active {
  background: var(--accent); border-color: var(--accent);
  color: #241a05; font-weight: 600;
}

/* ---------- 场景抽屉 ---------- */
#scene-drawer {
  position: fixed; top: 66px; right: 14px; z-index: 29;
  width: 232px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}
.drawer-title {
  font-size: 12px; color: var(--text-dim);
  letter-spacing: 2px; margin-bottom: 8px;
}
.chip-scene {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  background: none; border: none;
  color: var(--text);
  font-size: 14px;
  padding: 9px 10px; border-radius: 9px;
  cursor: pointer; text-align: left;
}
.chip-scene:hover { background: rgba(255, 255, 255, 0.08); }
.chip-scene.active { background: rgba(217, 164, 65, 0.18); color: var(--accent-soft); }
.chip-scene .idx {
  font-size: 11px; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  min-width: 18px;
}
.chip-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.chip-name {
  font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip-desc {
  font-size: 11px; color: var(--text-dim); line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 提示条 ---------- */
#hint-toast {
  position: fixed; bottom: 40px; left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 13px; color: var(--text);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 13px;
  max-width: 88vw;
  text-align: center;
  white-space: normal;
  animation: toast-in 0.5s ease both;
  pointer-events: none;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- 调试 ---------- */
#debug-bar {
  position: fixed; bottom: 14px; left: 50%;
  transform: translateX(-50%);
  z-index: 26;
  display: flex; gap: 14px; align-items: center;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(0, 255, 140, 0.35);
  border-radius: 10px;
  padding: 8px 14px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px; color: #6dffb0;
  max-width: 94vw;
}
#debug-bar em {
  font-style: normal; font-family: inherit;
  color: var(--text-dim); font-size: 11px;
}
#debug-cross {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -52%);
  z-index: 26;
  font-size: 26px; font-weight: 300;
  color: rgba(109, 255, 176, 0.9);
  pointer-events: none;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
}

/* ---------- 弹窗 ---------- */
#modal-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(4, 6, 10, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fade-in 0.22s ease both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

#modal-card {
  position: relative;
  width: min(720px, 94vw);
  max-height: 88vh;
  max-height: 88dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: #141822;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  animation: card-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
#modal-close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(10, 12, 18, 0.8);
  color: var(--text); font-size: 20px; line-height: 1;
  cursor: pointer;
}
#modal-close:hover { background: var(--accent); color: #241a05; }

#modal-img {
  display: block; width: 100%;
  max-height: 56vh; max-height: 56dvh;
  object-fit: contain;
  background:
    linear-gradient(45deg, #1a1f2b 25%, transparent 25%, transparent 75%, #1a1f2b 75%),
    linear-gradient(45deg, #1a1f2b 25%, #161a24 25%, #161a24 75%, #1a1f2b 75%);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
  border-radius: 18px 18px 0 0;
}
#modal-img.no-photo { display: none; }

.modal-body { padding: 20px 24px 26px; }
#modal-meta {
  display: inline-block;
  font-size: 11px; letter-spacing: 2px;
  color: var(--accent);
  border: 1px solid rgba(217, 164, 65, 0.5);
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 10px;
}
#modal-title { font-size: 22px; letter-spacing: 1px; margin-bottom: 10px; }
#modal-desc {
  font-size: 14px; line-height: 1.9;
  color: #c6cbd4;
}

/* ---------- 黑场过渡 ---------- */
#fade-layer {
  position: fixed; inset: 0; z-index: 35;
  background: #000; opacity: 0;
  pointer-events: none;
  transition: opacity 0.42s ease;
}
#fade-layer.on { opacity: 1; pointer-events: all; }

/* ---------- 加载 ---------- */
#loading {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 22px;
  transition: opacity 0.5s ease;
}
#loading.off { opacity: 0; pointer-events: none; }
.loader-ring {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 3px solid rgba(217, 164, 65, 0.2);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text { font-size: 13px; letter-spacing: 3px; color: var(--text-dim); }

.hidden { display: none !important; }

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  #top-bar {
    padding: calc(8px + env(safe-area-inset-top)) 10px 10px;
    gap: 6px 8px;
  }
  #tour-title { font-size: 15px; letter-spacing: 1px; }
  #scene-name { font-size: 11px; max-width: 46vw; }
  .top-actions { gap: 6px; }
  .chip { font-size: 12px; padding: 7px 11px; }

  #scene-drawer {
    top: calc(env(safe-area-inset-top) + 56px);
    right: 10px; width: 176px;
  }

  /* 热点：加大触控目标，标签防溢出 */
  .hs-icon { width: 44px; height: 44px; }
  .hs-icon svg { width: 22px; height: 22px; }
  .hs-label {
    font-size: 12px;
    max-width: 96px;
    overflow: hidden; text-overflow: ellipsis;
  }

  /* 弹窗改为底部抽屉式 */
  #modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  #modal-card {
    width: 100vw;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 18px 18px 0 0;
    border-left: none; border-right: none; border-bottom: none;
    animation: sheet-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.05) both;
  }
  #modal-close { width: 44px; height: 44px; top: 10px; right: 10px; }
  #modal-img {
    max-height: 40vh;
    max-height: 40dvh;
    border-radius: 18px 18px 0 0;
  }
  .modal-body { padding: 18px 20px calc(22px + env(safe-area-inset-bottom)); }
  #modal-title { font-size: 20px; }
  #modal-desc { font-size: 14px; line-height: 1.85; }

  #hint-toast {
    bottom: calc(38px + env(safe-area-inset-bottom));
    font-size: 12px;
  }
  #debug-bar {
    bottom: calc(10px + env(safe-area-inset-bottom));
    font-size: 11px; gap: 8px;
  }
  #debug-bar em { display: none; }
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(48px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 手机横屏（看全景的常见姿势）：压缩纵向空间 ---------- */
@media (max-height: 480px) and (orientation: landscape) {
  #top-bar {
    padding-top: calc(5px + env(safe-area-inset-top));
    padding-bottom: 6px;
    gap: 4px 8px;
  }
  #scene-name { display: none; }
  #tour-title { font-size: 14px; letter-spacing: 1px; }
  .chip { font-size: 12px; padding: 5px 10px; }
  #scene-drawer { top: calc(env(safe-area-inset-top) + 46px); }
  #hint-toast { bottom: 10px; }
  #modal-img {
    max-height: 52vh;
    max-height: 52dvh;
  }
}
