/* ========== 朱雀二号 3D 导览 · 深色科技风 UI ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: #070b14;
  color: #dfe8f5;
  user-select: none;
  overscroll-behavior: none; /* 防止橡皮筋滚动干扰 3D 交互 */
}

button { touch-action: manipulation; } /* 避免双击缩放延迟 */

/* ---------- 加载提示 ---------- */
#loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: #070b14;
  transition: opacity 0.6s;
}
#loading.done { opacity: 0; pointer-events: none; }
#loading .spinner {
  width: 46px;
  height: 46px;
  border: 3px solid rgba(66, 165, 245, 0.2);
  border-top-color: #42a5f5;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading p { color: #7fa8d8; font-size: 14px; letter-spacing: 2px; }

/* ---------- 顶部标题栏 ---------- */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 22px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(7, 11, 20, 0.85), rgba(7, 11, 20, 0));
}
.title-block h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #eaf3ff;
  text-shadow: 0 0 18px rgba(66, 165, 245, 0.5);
}
.title-block h1 .en {
  font-size: 14px;
  letter-spacing: 3px;
  color: #42a5f5;
  margin-left: 6px;
  vertical-align: middle;
}
.title-block p {
  margin-top: 5px;
  font-size: 12px;
  color: #8ba7c9;
  letter-spacing: 1.5px;
}

/* ---------- 模式按钮组 ---------- */
#mode-bar {
  display: flex;
  gap: 8px;
  pointer-events: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.mode-btn {
  padding: 7px 14px;
  font-size: 13px;
  color: #b9d2ef;
  background: rgba(16, 28, 48, 0.8);
  border: 1px solid rgba(66, 165, 245, 0.35);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 1px;
}
.mode-btn:hover { background: rgba(30, 55, 90, 0.9); color: #fff; }
.mode-btn.active {
  background: rgba(66, 165, 245, 0.25);
  border-color: #42a5f5;
  color: #9fd4ff;
  box-shadow: 0 0 12px rgba(66, 165, 245, 0.35);
}
.mode-btn.accent {
  border-color: rgba(255, 152, 0, 0.5);
  color: #ffd9a0;
}
.mode-btn.accent:hover { background: rgba(120, 70, 10, 0.5); }
.mode-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- 3D 画布 ---------- */
#scene-container {
  position: fixed;
  inset: 0;
  z-index: 1;
}
#scene-container canvas {
  display: block;
  touch-action: none; /* 3D 画布不接受浏览器手势（缩放/滚动），交给 OrbitControls */
}

/* ---------- 爆炸视图滑块 ---------- */
#explode-bar {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: rgba(12, 20, 36, 0.88);
  border: 1px solid rgba(66, 165, 245, 0.35);
  border-radius: 10px;
  font-size: 12px;
  color: #8ba7c9;
}
#explode-bar.hidden { display: none; }
#explode-slider {
  width: 260px;
  accent-color: #42a5f5;
  cursor: pointer;
}

/* ---------- 步骤教学面板 ---------- */
#info-panel {
  position: fixed;
  top: 96px;
  right: 22px;
  z-index: 20;
  width: 330px;
  max-height: calc(100vh - 240px);
  overflow-y: auto;
  padding: 18px 20px;
  background: rgba(10, 18, 32, 0.88);
  border: 1px solid rgba(66, 165, 245, 0.3);
  border-radius: 12px;
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.5);
}
#step-counter {
  font-size: 12px;
  color: #42a5f5;
  letter-spacing: 2px;
  margin-bottom: 8px;
}
/* 桌面端面板头部保持原流式布局，抽屉把手仅移动端使用 */
#panel-header { display: contents; }
#panel-chevron { display: none; }
#step-title {
  font-size: 18px;
  color: #eaf3ff;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(66, 165, 245, 0.25);
}
#step-body { font-size: 13.5px; line-height: 1.85; color: #b9cbe4; }
#step-body p { margin-bottom: 8px; }
#step-body strong { color: #9fd4ff; font-weight: 600; }
#step-body .fact {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 2px 8px;
  font-size: 12px;
  color: #9fd4ff;
  background: rgba(66, 165, 245, 0.12);
  border: 1px solid rgba(66, 165, 245, 0.3);
  border-radius: 4px;
}

/* ---------- 底部步骤导航 ---------- */
#tour-bar {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: rgba(10, 18, 32, 0.88);
  border: 1px solid rgba(66, 165, 245, 0.3);
  border-radius: 12px;
  backdrop-filter: blur(6px);
}
.nav-btn {
  padding: 8px 18px;
  font-size: 13px;
  color: #b9d2ef;
  background: rgba(22, 38, 64, 0.9);
  border: 1px solid rgba(66, 165, 245, 0.4);
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 1px;
}
.nav-btn:hover:not(:disabled) { background: rgba(66, 165, 245, 0.3); color: #fff; }
.nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }
#step-dots { display: flex; gap: 8px; }
#step-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(120, 160, 210, 0.3);
  border: 1px solid rgba(120, 160, 210, 0.5);
  cursor: pointer;
  transition: all 0.25s;
}
#step-dots .dot:hover { background: rgba(66, 165, 245, 0.6); }
#step-dots .dot.active {
  background: #42a5f5;
  border-color: #9fd4ff;
  box-shadow: 0 0 10px rgba(66, 165, 245, 0.8);
  transform: scale(1.25);
}

/* ---------- 热点标注点（CSS2D） ---------- */
/* 外层 44×44 透明触控靶区，内层 18px 可视圆点（移动端 tap target ≥ 44px） */
.hotspot {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
}
.hotspot-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(66, 165, 245, 0.9);
  border: 2px solid #d6ecff;
  color: #06233f;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.15s;
}
.hotspot:hover .hotspot-dot { transform: scale(1.35); }
.hotspot-dot::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(66, 165, 245, 0.7);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}
.hotspot.hidden { display: none; }

/* ---------- 热点说明卡片 ---------- */
#hotspot-card {
  position: fixed;
  bottom: 96px;
  right: 22px;
  z-index: 30;
  width: 300px;
  padding: 16px 18px;
  background: rgba(12, 22, 40, 0.95);
  border: 1px solid rgba(66, 165, 245, 0.5);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}
#hotspot-card.hidden { display: none; }
#hotspot-card h3 {
  font-size: 15px;
  color: #9fd4ff;
  margin-bottom: 8px;
  padding-right: 22px;
}
#hotspot-card p { font-size: 13px; line-height: 1.8; color: #b9cbe4; }
#hotspot-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(66, 165, 245, 0.2);
  color: #9fd4ff;
  font-size: 14px;
  cursor: pointer;
}
#hotspot-close:hover { background: rgba(66, 165, 245, 0.45); color: #fff; }

/* ---------- 发射阶段提示 ---------- */
#launch-status {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  padding: 10px 26px;
  font-size: 15px;
  letter-spacing: 2px;
  color: #ffd9a0;
  background: rgba(30, 18, 6, 0.85);
  border: 1px solid rgba(255, 152, 0, 0.5);
  border-radius: 8px;
  box-shadow: 0 0 24px rgba(255, 152, 0, 0.25);
}
#launch-status.hidden { display: none; }

/* ---------- 窄屏简单适配 ---------- */
@media (max-width: 900px) {
  #info-panel { width: 260px; top: 120px; }
  .title-block h1 { font-size: 18px; }
}

/* ================================================================
   移动端适配（≤768px 或横屏小高度）：底部抽屉面板 + 紧凑按钮组 + safe-area
   ================================================================ */
@media (max-width: 768px), (max-height: 500px) {
  /* ---- 顶部：标题收缩 + 模式按钮横滑一行 ---- */
  #topbar {
    flex-direction: column;
    gap: 8px;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  }
  .title-block h1 { font-size: 17px; letter-spacing: 2px; }
  .title-block h1 .en { font-size: 11px; }
  .title-block p { font-size: 10px; margin-top: 2px; }
  #mode-bar {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
  }
  #mode-bar::-webkit-scrollbar { display: none; }
  .mode-btn {
    flex: 0 0 auto;
    min-height: 44px; /* 触控靶区 */
    padding: 6px 12px;
    font-size: 12px;
    white-space: nowrap;
  }

  /* ---- 信息面板：底部抽屉（位于步骤条之上，不遮挡导航），点头部展开全文 ---- */
  #info-panel {
    top: auto;
    right: 0;
    left: 0;
    bottom: calc(70px + env(safe-area-inset-bottom));
    width: auto;
    max-height: 55vh;
    padding: 0 16px 10px;
    border-radius: 16px 16px 0 0;
    overflow-y: hidden;
    z-index: 26;
  }
  #panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    cursor: pointer;
  }
  #step-counter { margin-bottom: 0; flex: 0 0 auto; }
  #step-title {
    flex: 1 1 auto;
    font-size: 15px;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #panel-chevron {
    display: block;
    flex: 0 0 auto;
    color: #42a5f5;
    font-size: 14px;
    transition: transform 0.25s;
  }
  #step-body {
    font-size: 13px;
    max-height: calc(55vh - 70px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: 10px;
    border-top: 1px solid rgba(66, 165, 245, 0.25);
  }
  /* 收起态：只留头部摘要 */
  #info-panel.collapsed #step-body { display: none; }
  #info-panel.collapsed #panel-chevron { transform: rotate(180deg); }

  /* ---- 步骤条：紧凑化，贴屏幕底部（抽屉在其上方） ---- */
  #tour-bar {
    bottom: calc(10px + env(safe-area-inset-bottom));
    padding: 6px 10px;
    gap: 10px;
    border-radius: 10px;
  }
  .nav-btn { min-height: 44px; padding: 8px 12px; font-size: 12px; white-space: nowrap; }
  #step-dots { gap: 6px; }
  #step-dots .dot { width: 9px; height: 9px; }

  /* ---- 爆炸滑块：收起态抽屉上方 ---- */
  #explode-bar {
    bottom: calc(134px + env(safe-area-inset-bottom));
    padding: 8px 12px;
  }
  #explode-slider { width: 40vw; }

  /* ---- 热点卡片：窄屏全宽、限高可滚 ---- */
  #hotspot-card {
    left: 12px;
    right: 12px;
    bottom: calc(134px + env(safe-area-inset-bottom));
    width: auto;
    max-height: 38vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px 16px;
  }
  #hotspot-card p { font-size: 12.5px; }
  #hotspot-close { width: 32px; height: 32px; font-size: 18px; }

  /* ---- 发射提示 ---- */
  #launch-status {
    top: calc(118px + env(safe-area-inset-top));
    max-width: 92vw;
    padding: 8px 16px;
    font-size: 13px;
    text-align: center;
  }
}

/* ---- 横屏小高度：面板更不挡主体（默认收起由 JS 判断），标题再收缩 ---- */
@media (max-height: 500px) and (orientation: landscape) {
  .title-block p { display: none; }
  .title-block h1 { font-size: 15px; }
  #info-panel { max-height: 72vh; }
  #step-body { max-height: calc(72vh - 70px); }
  #launch-status { top: calc(64px + env(safe-area-inset-top)); }
}
