/* ========== 星际入口 Demo 样式 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, #141233 0%, #0b0a22 45%, #070714 100%);
  color: #e5e7ff;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#scene-container {
  position: absolute;
  inset: 0;
  touch-action: none;
}
#scene-container canvas { display: block; }

/* ---------- 卫星标签层 ---------- */
#labels-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 20;
}
.satellite-label {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  white-space: nowrap;
  color: #f2f3ff;
  background: rgba(18, 16, 48, 0.55);
  border: 1px solid rgba(167, 139, 250, 0.45);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.35), inset 0 0 8px rgba(139, 92, 246, 0.12);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: auto;
  cursor: pointer;
  will-change: transform, opacity;
  transition: opacity 0.15s linear;
  touch-action: none;
}
.satellite-label .sat-icon { font-size: 14px; line-height: 1; }
.satellite-label.tone-cyan {
  border-color: rgba(103, 232, 249, 0.45);
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.3), inset 0 0 8px rgba(34, 211, 238, 0.12);
}
.satellite-label.is-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}
.satellite-label:active {
  transform-origin: center;
  filter: brightness(1.5);
}

.bridge-glow {
  background: linear-gradient(90deg, rgba(139, 92, 246, 0) 0%, rgba(139, 92, 246, 0.55) 30%, rgba(34, 211, 238, 0.55) 70%, rgba(34, 211, 238, 0) 100%);
  filter: blur(10px);
  margin-top: -13px; /* 高度一半，使 rotate 锚点在球心连线上 */
}
.bridge-core {
  height: 5px;
  background: linear-gradient(90deg, rgba(196, 181, 253, 0) 0%, rgba(196, 181, 253, 0.9) 30%, rgba(165, 243, 252, 0.9) 70%, rgba(165, 243, 252, 0) 100%);
  filter: blur(1.5px);
  margin-top: -2.5px;
}

/* ---------- 顶部栏 ---------- */
.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 18px 12px;
  background: linear-gradient(180deg, rgba(10, 9, 32, 0.72) 0%, rgba(10, 9, 32, 0) 100%);
  pointer-events: none;
}
.top-bar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: conic-gradient(from 210deg, #8b5cf6, #22d3ee, #c084fc, #8b5cf6);
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.8), 0 0 26px rgba(34, 211, 238, 0.35);
}
.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #c4b5fd, #67e8f9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.top-actions { display: flex; gap: 10px; }
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(148, 140, 255, 0.3);
  background: rgba(20, 18, 51, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 15px;
  color: #e5e7ff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:active { filter: brightness(1.6); }

/* ---------- 底部栏 ---------- */
.bottom-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 18px calc(env(safe-area-inset-bottom, 0px) + 16px);
  background: linear-gradient(0deg, rgba(10, 9, 32, 0.72) 0%, rgba(10, 9, 32, 0) 100%);
  pointer-events: none;
}
.bottom-bar > * { pointer-events: auto; }
.drag-hint {
  font-size: 12px;
  letter-spacing: 2px;
  color: rgba(199, 203, 255, 0.6);
  transition: opacity 1.2s ease;
  pointer-events: none;
}
.drag-hint.faded { opacity: 0.35; }

/* ---------- Toast ---------- */
#toast {
  position: absolute;
  left: 50%;
  bottom: 26%;
  transform: translateX(-50%) translateY(12px);
  z-index: 60;
  max-width: 78vw;
  padding: 11px 20px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  color: #f2f3ff;
  background: rgba(24, 22, 58, 0.85);
  border: 1px solid rgba(148, 140, 255, 0.35);
  box-shadow: 0 6px 30px rgba(80, 70, 229, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- 降级层 ---------- */
#fallback {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 30px 26px calc(env(safe-area-inset-bottom, 0px) + 90px);
  overflow-y: auto;
}
#fallback[hidden] { display: none; }
.fb-planet {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  position: relative;
  flex: none;
}
.fb-planet.purple {
  background: radial-gradient(circle at 32% 30%, #a78bfa 0%, #7c3aed 42%, #2e1065 100%);
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.6);
}
.fb-planet.cyan {
  background: radial-gradient(circle at 32% 30%, #67e8f9 0%, #0891b2 42%, #164e63 100%);
  box-shadow: 0 0 40px rgba(34, 211, 238, 0.55);
}
.fb-planet::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 210%;
  height: 46%;
  border-radius: 50%;
  border: 3px solid rgba(196, 181, 253, 0.35);
  transform: translate(-50%, -50%) rotate(-16deg);
}
.fb-module-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #dfe2ff;
}
.fb-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 340px;
}
.fb-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 16px;
  border-radius: 14px;
  font-size: 14px;
  color: #eef0ff;
  background: rgba(24, 22, 58, 0.6);
  border: 1px solid rgba(148, 140, 255, 0.28);
  cursor: pointer;
}
.fb-menu-item:active { filter: brightness(1.5); }
.fb-reason { font-size: 12px; color: rgba(199, 203, 255, 0.45); letter-spacing: 1px; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .drag-hint { transition: none; }
}
