/* ========== 设计令牌 ========== */
:root {
  --space-bg: #03050a;
  --space-deep: #05081a;
  --orbit-blue: #3B82F6;
  --orbit-purple: #8B5CF6;
  --orbit-cyan: #06B6D4;
  --text: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.55);
  --surface: rgba(255, 255, 255, 0.04);
  --surface-elevated: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --duration-base: 700ms;
  --duration-slow: 1100ms;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--space-bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body {
  background:
    radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(6, 182, 212, 0.04) 0%, transparent 55%),
    linear-gradient(180deg, #02040a 0%, #050817 100%);
}

body.loading .orbit-header,
body.loading .orbit-stage {
  opacity: 0;
  transform: scale(0.98);
}

body:not(.loading) .orbit-header,
body:not(.loading) .orbit-stage {
  opacity: 1;
  transform: scale(1);
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
}

/* ========== 鉴权门 ========== */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--space-bg);
  transition: opacity 400ms var(--ease-out), visibility 400ms var(--ease-out);
}

body:not(.loading) .auth-gate {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-gate-portal {
  position: relative;
  width: 120px;
  height: 120px;
  display: grid;
  place-items: center;
}

.portal-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(6, 182, 212, 0.35);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.15);
  animation: portalPulse 2.4s ease-in-out infinite;
}

.portal-ring:nth-child(1) { animation-delay: 0s; }
.portal-ring:nth-child(2) { animation-delay: 0.6s; }
.portal-ring:nth-child(3) { animation-delay: 1.2s; }

.portal-label {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  white-space: nowrap;
}

@keyframes portalPulse {
  0% { transform: scale(0.6); opacity: 0; }
  50% { opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

button {
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ========== 星空背景画布 ========== */
.starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.85;
}

/* ========== 顶部栏 ========== */
.orbit-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px;
  pointer-events: none;
}

.brand-mark,
.header-actions,
.icon-btn {
  pointer-events: auto;
}

.brand-mark {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}

.mark-star {
  color: var(--orbit-cyan);
  margin-left: 2px;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: rgba(255, 255, 255, 0.7);
  transition: all 240ms var(--ease-out);
}

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

@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover {
    background: var(--surface-elevated);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text);
    transform: translateY(-1px);
  }
}

/* ========== 舞台 ========== */
.orbit-stage {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.orbit-system {
  position: relative;
  width: min(92vw, 1200px);
  height: min(90vh, 900px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform var(--duration-slow) var(--ease-in-out),
    opacity var(--duration-base) var(--ease-out);
}

.state-expanded .orbit-system {
  transform: scale(0.72) translateX(-22vw);
  opacity: 0.6;
}

/* ========== 轨道 SVG ========== */
.orbit-svg {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: rotate(-90deg);
}

.orbit-svg circle {
  transition: filter var(--duration-base) var(--ease-out);
}

.state-expanded .orbit-svg circle {
  filter: url(#orbitGlow) brightness(0.6);
}

/* ========== 粒子层 ========== */
.orbit-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.orbit-particle {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.6);
  offset-path: path("M 500,500 m -360,0 a 360,360 0 1,1 720,0 a 360,360 0 1,1 -720,0");
  offset-rotate: 0deg;
  animation: orbitParticle 18s linear infinite;
}

@keyframes orbitParticle {
  from { offset-distance: 0%; }
  to { offset-distance: 100%; }
}

/* ========== 品牌中心 ========== */
.brand-center {
  position: absolute;
  left: 28%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: left;
  z-index: 2;
  transition:
    transform var(--duration-slow) var(--ease-in-out),
    opacity var(--duration-base) var(--ease-out);
}

.state-expanded .brand-center {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.9);
}

.brand-title {
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.1;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #ffffff 0%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-subtitle {
  font-size: clamp(0.85rem, 1.2vw, 1rem);
  color: var(--text-dim);
  letter-spacing: 0.18em;
}

/* ========== 节点导航 ========== */
.orbit-nodes {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.node-group {
  position: absolute;
  left: var(--node-x);
  top: var(--node-y);
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 0;
  pointer-events: auto;
  transition:
    transform var(--duration-base) var(--ease-out),
    opacity var(--duration-base) var(--ease-out);
}

.node-group:not(.active) {
  opacity: 0.75;
}

@media (hover: hover) and (pointer: fine) {
  .node-group:hover {
    opacity: 1;
  }

  .node-group:hover .planet-node {
    transform: scale(1.18);
  }

  .node-group:hover .node-beam {
    width: 90px;
    opacity: 1;
    box-shadow: 0 0 18px rgba(6, 182, 212, 0.45);
  }

  .node-group:hover .node-text {
    transform: translateX(6px);
  }

  .node-group:hover .node-title {
    color: #ffffff;
  }
}

.state-expanded .node-group:not(.active) {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.8);
  pointer-events: none;
}

/* 选中节点展开态 */
.node-group.active {
  opacity: 1;
  z-index: 10;
}

.state-expanded .node-group.active {
  transform: translate(-50%, -50%) scale(1.35);
}

/* ========== 星球节点 ========== */
.planet-node {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.16), transparent 60%),
              linear-gradient(135deg, rgba(59,130,246,0.35), rgba(139,92,246,0.35));
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow:
    inset 0 0 20px rgba(255,255,255,0.05),
    0 0 0 1px rgba(6,182,212,0.15),
    0 8px 32px rgba(59,130,246,0.2);
  transition: transform var(--duration-base) var(--ease-out);
  animation: nodeBreathe 4s ease-in-out infinite;
}

.node-icon {
  font-size: 1.4rem;
  line-height: 1;
  filter: drop-shadow(0 0 4px rgba(255,255,255,0.3));
}

.node-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid rgba(6, 182, 212, 0.25);
  opacity: 0.6;
  animation: ringPulse 3s ease-in-out infinite;
}

@keyframes nodeBreathe {
  0%, 100% { box-shadow: inset 0 0 20px rgba(255,255,255,0.05), 0 0 0 1px rgba(6,182,212,0.15), 0 8px 32px rgba(59,130,246,0.2); }
  50% { box-shadow: inset 0 0 24px rgba(255,255,255,0.08), 0 0 0 1px rgba(6,182,212,0.25), 0 12px 42px rgba(59,130,246,0.32); }
}

@keyframes ringPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.08); opacity: 0.25; }
}

/* ========== 发光引线 ========== */
.node-beam {
  width: 64px;
  height: 1px;
  background: linear-gradient(90deg, rgba(6,182,212,0.9), rgba(139,92,246,0.4));
  margin-left: 10px;
  margin-right: 16px;
  opacity: 0.75;
  transition: all var(--duration-base) var(--ease-out);
}

/* ========== 节点文字 ========== */
.node-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 120px;
  text-align: left;
  transition: transform var(--duration-base) var(--ease-out);
}

.node-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.06em;
  transition: color var(--duration-base) var(--ease-out);
}

.node-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

/* ========== 展开面板 ========== */
.module-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(560px, 100vw);
  height: 100%;
  z-index: 15;
  background:
    linear-gradient(180deg, rgba(5, 8, 23, 0.96) 0%, rgba(3, 5, 10, 0.98) 100%);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transform: translateX(110%);
  opacity: 0;
  transition:
    transform var(--duration-slow) var(--ease-in-out),
    opacity var(--duration-base) var(--ease-out);
  display: flex;
  flex-direction: column;
  padding: 80px 44px 44px;
}

.state-expanded .module-panel {
  transform: translateX(0);
  opacity: 1;
}

.panel-back {
  position: absolute;
  top: 28px;
  left: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  transition: color var(--duration-base) var(--ease-out);
}

.panel-back svg {
  width: 18px;
  height: 18px;
}

@media (hover: hover) and (pointer: fine) {
  .panel-back:hover {
    color: var(--text);
  }
}

.panel-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
}

.panel-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2rem;
  background: linear-gradient(135deg, rgba(59,130,246,0.25), rgba(139,92,246,0.25));
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 8px 32px rgba(59,130,246,0.2);
}

.panel-title {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.06em;
}

.panel-desc {
  font-size: 1rem;
  color: var(--text-dim);
  line-height: 1.6;
  max-width: 420px;
}

.panel-visual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 8px;
}

.hud-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hud-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hud-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.hud-chart {
  grid-column: 1 / -1;
  height: 110px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

.hud-chart svg {
  width: 100%;
  height: 100%;
}

/* ========== 启航按钮 ========== */
.launch-btn {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--orbit-blue), var(--orbit-purple));
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.35);
  transition: transform var(--duration-base) var(--ease-out), box-shadow var(--duration-base) var(--ease-out);
}

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

.launch-btn:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .launch-btn:hover {
    box-shadow: 0 12px 42px rgba(59, 130, 246, 0.48);
    transform: translateY(-2px);
  }
}

/* ========== 移动端适配 ========== */
@media (max-width: 768px) {
  .orbit-header {
    padding: 16px 20px;
  }

  .orbit-system {
    width: 100vw;
    height: 90vh;
  }

  .brand-center {
    left: 50%;
    top: 18%;
    text-align: center;
    transform: translate(-50%, -50%);
  }

  .state-expanded .brand-center {
    transform: translate(-50%, -50%) scale(0.9);
  }

  .node-group {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .node-beam {
    width: 1px;
    height: 32px;
    margin: 8px 0;
    background: linear-gradient(180deg, rgba(6,182,212,0.9), rgba(139,92,246,0.4));
  }

  .node-text {
    align-items: center;
  }

  .state-expanded .orbit-system {
    transform: scale(0.55) translateY(-10vh);
    opacity: 0.35;
  }

  .module-panel {
    width: 100%;
    padding: 72px 24px 32px;
  }
}

/* ========== 减少动画 ========== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
