/* ============================================
   展示一：3D 旋转地球
   ============================================ */
#globe-section {
  position: relative;
  padding: 60px 20px;
  background: radial-gradient(ellipse at center, #0a1628 0%, #000810 100%);
  overflow: hidden;
  min-height: 600px;
}

#globe-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.5) 0%, transparent 100%),
                    radial-gradient(1px 1px at 60% 70%, rgba(255,255,255,0.4) 0%, transparent 100%),
                    radial-gradient(1px 1px at 80% 20%, rgba(255,255,255,0.3) 0%, transparent 100%),
                    radial-gradient(1.5px 1.5px at 40% 80%, rgba(255,255,255,0.6) 0%, transparent 100%);
  background-size: 200px 200px, 300px 300px, 250px 250px, 350px 350px;
  animation: starTwinkle 4s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes starTwinkle {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

.globe-header {
  text-align: center;
  margin-bottom: 30px;
  position: relative;
  z-index: 2;
}

.globe-header h2 {
  color: #f0e6d3;
  font-size: 2rem;
  margin-bottom: 10px;
  text-shadow: 0 0 20px rgba(230, 126, 34, 0.5);
}

.globe-header p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
}

#globe-container {
  width: 100%;
  max-width: 700px;
  height: 500px;
  margin: 0 auto;
  position: relative;
  cursor: grab;
}

#globe-container:active {
  cursor: grabbing;
}

/* 地球样式 */
.globe-ocean {
  fill: #0c2340;
  stroke: rgba(100, 200, 255, 0.2);
  stroke-width: 1.5;
}

.globe-graticule {
  fill: none;
  stroke: rgba(100, 180, 255, 0.08);
  stroke-width: 0.5;
}

.globe-country {
  fill: #1a3a5c;
  stroke: rgba(100, 200, 255, 0.25);
  stroke-width: 0.4;
  transition: fill 0.3s;
}

.globe-china {
  fill: #E67E22 !important;
  stroke: #f5c842 !important;
  stroke-width: 1.2;
  filter: drop-shadow(0 0 6px rgba(230, 126, 34, 0.6));
}

.globe-label {
  font-size: 9px;
  fill: rgba(200, 220, 255, 0.7);
  text-anchor: middle;
  pointer-events: none;
  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.globe-label-china {
  font-size: 12px;
  fill: #f5c842;
  font-weight: bold;
  text-shadow: 0 0 4px rgba(245, 200, 66, 0.5);
}

.globe-label-beijing {
  font-size: 10px;
  fill: #ff4444;
  text-anchor: start;
  font-weight: bold;
}

.globe-label-xianning {
  font-size: 10px;
  fill: #00e676;
  text-anchor: start;
  font-weight: bold;
}

.globe-beijing-star {
  fill: #ff2020;
  stroke: #ffcc00;
  stroke-width: 0.5;
  filter: drop-shadow(0 0 4px rgba(255, 32, 32, 0.8));
  animation: starPulse 2s ease-in-out infinite;
}

@keyframes starPulse {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(255, 32, 32, 0.8)); }
  50% { filter: drop-shadow(0 0 10px rgba(255, 32, 32, 1)); }
}

.globe-xianning-dot {
  fill: #00e676;
  stroke: #fff;
  stroke-width: 1;
  animation: xnPulse 1.5s ease-in-out infinite;
}

@keyframes xnPulse {
  0%, 100% { r: 5; opacity: 1; }
  50% { r: 7; opacity: 0.7; }
}

/* ============================================
   展示二：太空穿越 + 四大风物旋转（修复版）
   ============================================ */
#xianning-section {
  position: relative;
  padding: 80px 20px;
  background: radial-gradient(ellipse at 50% 30%, #0d1f3c 0%, #020a14 100%);
  overflow: visible;
  min-height: 700px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#xianning-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(1px 1px at 10% 20%, #fff 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 30% 60%, #fff 0%, transparent 100%),
    radial-gradient(1px 1px at 50% 40%, #fff 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 80%, #fff 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 90% 30%, #fff 0%, transparent 100%);
  background-size: 250px 250px, 300px 300px, 200px 200px, 350px 350px, 280px 280px;
  opacity: 0.5;
  pointer-events: none;
}

.xn-header {
  text-align: center;
  margin-bottom: 40px;
  position: relative;
  z-index: 5;
}

.xn-header h2 {
  color: #f0e6d3;
  font-size: 2rem;
  margin-bottom: 12px;
  text-shadow: 0 0 20px rgba(230, 126, 34, 0.4);
}

.xn-header p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 1rem;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.8;
}

.xn-header .xn-subtitle {
  color: #E67E22;
  font-weight: bold;
  font-size: 1.1rem;
  margin-top: 8px;
}

/* ---- 舞台 ---- */
.xn-stage {
  position: relative;
  width: 500px;
  height: 420px;
  margin: 0 auto;
  z-index: 3;
}

/* ---- 地球 ---- */
.xn-earth {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200px;
  height: 200px;
  margin: -100px 0 0 -100px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #1a5276, #0a2540 70%, #000 100%);
  box-shadow: inset -15px -15px 30px rgba(0,0,0,0.6), 0 0 60px rgba(100,200,255,0.3);
  opacity: 0;
  transform: scale(0.2);
  z-index: 10;
}

.xn-earth::before {
  content: '';
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(230,126,34,0.7) 0%, transparent 25%),
    radial-gradient(ellipse at 30% 30%, rgba(34,139,34,0.4) 0%, transparent 18%),
    radial-gradient(ellipse at 70% 60%, rgba(34,139,34,0.3) 0%, transparent 15%);
}

.xn-earth::after {
  content: '';
  position: absolute;
  top: 43%;
  left: 53%;
  width: 8px;
  height: 8px;
  background: #00e676;
  border-radius: 50%;
  box-shadow: 0 0 8px #00e676, 0 0 16px #00e676;
  opacity: 0;
}

.xn-earth-glow {
  position: absolute;
  inset: -15px;
  border-radius: 50%;
  border: 2px solid rgba(100,200,255,0.15);
  box-shadow: 0 0 30px rgba(100,200,255,0.1);
  opacity: 0;
}

/* ---- 穿越光线 ---- */
.xn-warp-lines {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  opacity: 0;
}

.xn-warp-lines span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 0;
  background: linear-gradient(to bottom, transparent, rgba(100,200,255,0.8), transparent);
  transform-origin: top center;
  border-radius: 2px;
}

.xn-warp-lines span:nth-child(1) { transform: rotate(0deg) translateX(-30px); }
.xn-warp-lines span:nth-child(2) { transform: rotate(45deg) translateX(20px); }
.xn-warp-lines span:nth-child(3) { transform: rotate(90deg) translateX(-15px); }
.xn-warp-lines span:nth-child(4) { transform: rotate(135deg) translateX(25px); }
.xn-warp-lines span:nth-child(5) { transform: rotate(180deg) translateX(-20px); }
.xn-warp-lines span:nth-child(6) { transform: rotate(225deg) translateX(30px); }
.xn-warp-lines span:nth-child(7) { transform: rotate(270deg) translateX(-25px); }
.xn-warp-lines span:nth-child(8) { transform: rotate(315deg) translateX(15px); }

/* ---- 中心咸宁标识 ---- */
.xn-center-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  z-index: 12;
  text-align: center;
  opacity: 0;
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.34,1.56,0.64,1);
}

.xn-center-logo .xn-city-name {
  font-size: 2.4rem;
  font-weight: 900;
  color: #E67E22;
  text-shadow: 0 0 20px rgba(230,126,34,0.6), 0 2px 4px rgba(0,0,0,0.5);
  font-family: 'STKaiti','KaiTi','SimSun', serif;
  letter-spacing: 8px;
}

.xn-center-logo .xn-city-sub {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.6);
  margin-top: 6px;
  letter-spacing: 2px;
}

/* ---- 四大风物轨道（关键修复） ---- */
.xn-orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  opacity: 0;
  z-index: 5;
}

.xn-card {
  position: absolute;
  width: 130px;
  height: 170px;
  margin-left: -65px;
  margin-top: -85px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
  transform: rotateY(calc(var(--i) * 90deg)) translateZ(200px);
}

.xn-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.xn-card span {
  display: block;
  text-align: center;
  padding: 10px 4px;
  color: #f0e6d3;
  font-size: 0.9rem;
  font-weight: bold;
  letter-spacing: 2px;
}

/* ---- 动画阶段 ---- */

/* 阶段1：地球飞入 + 穿越 合并为一段无缝动画 (2.5s) */
.xn-phase-1 .xn-earth {
  animation: earthFull 2.5s cubic-bezier(0.25,0.46,0.45,0.94) forwards;
}
.xn-phase-1 .xn-earth-glow {
  animation: glowFull 2.5s ease forwards;
}
.xn-phase-1 .xn-earth::after {
  animation: locateBlink 0.4s ease-in-out 0.8s 3 forwards;
}
.xn-phase-1 .xn-warp-lines {
  animation: warpShow 1.2s 0.8s ease forwards;
}
.xn-phase-1 .xn-warp-lines span {
  animation: warpStretch 1s 0.8s cubic-bezier(0.4,0,0.2,1) forwards;
}
.xn-phase-1 .xn-warp-lines span:nth-child(2) { animation-delay: 0.85s; }
.xn-phase-1 .xn-warp-lines span:nth-child(3) { animation-delay: 0.9s; }
.xn-phase-1 .xn-warp-lines span:nth-child(4) { animation-delay: 0.95s; }
.xn-phase-1 .xn-warp-lines span:nth-child(5) { animation-delay: 1.0s; }
.xn-phase-1 .xn-warp-lines span:nth-child(6) { animation-delay: 1.05s; }
.xn-phase-1 .xn-warp-lines span:nth-child(7) { animation-delay: 1.1s; }
.xn-phase-1 .xn-warp-lines span:nth-child(8) { animation-delay: 1.15s; }

@keyframes earthFull {
  /* 飞入阶段 (0→0.8s) */
  0%   { opacity: 0; transform: scale(0.2) rotateZ(-10deg); }
  32%  { opacity: 1; transform: scale(1) rotateZ(0deg); }
  /* 穿越阶段 (0.8→2.5s) */
  48%  { opacity: 1; transform: scale(1.3); }
  100% { opacity: 0; transform: scale(3); }
}

@keyframes glowFull {
  0%   { opacity: 0; }
  30%  { opacity: 1; }
  48%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(2); }
}

@keyframes locateBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
@keyframes warpShow {
  0% { opacity: 0; }
  30% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes warpStretch {
  0%   { height: 0; opacity: 0; }
  30%  { height: 80px; opacity: 1; }
  100% { height: 200px; opacity: 0; }
}

/* 阶段3：展开旋转 */
.xn-phase-3 .xn-earth,
.xn-phase-3 .xn-warp-lines {
  display: none;
}

.xn-phase-3 .xn-center-logo {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.xn-phase-3 .xn-orbit {
  opacity: 1;
  animation: orbitSpin 10s linear infinite;
}

@keyframes orbitSpin {
  from { transform: rotateY(0deg); }
  to   { transform: rotateY(360deg); }
}

.xn-orbit:hover {
  animation-play-state: paused;
}

/* 底部光晕 */
.xn-stage::after {
  content: '';
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  height: 50px;
  background: radial-gradient(ellipse, rgba(230,126,34,0.12) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s;
}
.xn-stage.xn-phase-3::after {
  opacity: 1;
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 768px) {
  #globe-container {
    height: 350px;
  }

  #globe-section {
    min-height: 450px;
    padding: 40px 10px;
  }

  .globe-header h2,
  .xn-header h2 {
    font-size: 1.5rem;
  }

  #xianning-section {
    min-height: 550px;
    padding: 50px 10px;
  }

  .xn-stage {
    width: auto;
    height: 350px;
    max-width: 400px;
  }

  .xn-earth {
    width: 150px;
    height: 150px;
    margin: -75px 0 0 -75px;
  }

  .xn-card {
    width: 105px;
    height: 140px;
    margin-left: -52px;
    margin-top: -70px;
    transform: rotateY(calc(var(--i) * 90deg)) translateZ(150px);
  }

  .xn-card img {
    height: 95px;
  }

  .xn-center-logo .xn-city-name {
    font-size: 1.8rem;
  }
}

@media (max-width: 480px) {
  #globe-container {
    height: 280px;
  }

  .xn-stage {
    width: auto;
    height: 300px;
    max-width: 320px;
  }

  .xn-earth {
    width: 120px;
    height: 120px;
    margin: -60px 0 0 -60px;
  }

  .xn-card {
    width: 85px;
    height: 115px;
    margin-left: -42px;
    margin-top: -57px;
    border-radius: 10px;
    transform: rotateY(calc(var(--i) * 90deg)) translateZ(115px);
  }

  .xn-card img {
    height: 75px;
  }

  .xn-card span {
    font-size: 0.75rem;
    padding: 6px 2px;
  }

  .xn-center-logo .xn-city-name {
    font-size: 1.4rem;
    letter-spacing: 4px;
  }

  .xn-center-logo .xn-city-sub {
    font-size: 0.65rem;
  }
}
