/* General Body Styles */
body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #0a0a1f; /* Dark blue-ish background */
    color: #e0e0e0; /* Light grey text */
    overflow: hidden; /* Prevent scrollbars from Three.js canvas */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

/* Loading Screen Styles */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    flex-direction: column; /* Align items vertically */
}

.loading-text-container {
    text-align: center;
}

.loading-text {
    color: #00ffff; /* Cyan text */
    font-size: 1.5em;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(0,255,255,0.7);
    letter-spacing: 1px;
    animation: text-pulse 1.6s ease-in-out infinite;
}

@keyframes text-pulse {
  0%   { opacity: 0.85; text-shadow: 0 0 6px rgba(0,255,255,0.4); }
  50%  { opacity: 1;    text-shadow: 0 0 16px rgba(0,255,255,0.9); }
  100% { opacity: 0.85; text-shadow: 0 0 6px rgba(0,255,255,0.4); }
}

.progress-bar-container {
    width: 300px;
    height: 20px;
    background-color: #333;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    position: relative;
    width: 0%;
    height: 100%;
    /* 由左到右的能量渐变 */
    background: linear-gradient(90deg, rgba(0,255,255,0.55) 0%, rgba(0,255,255,0.85) 50%, rgba(0,255,255,1) 100%);
    box-shadow: 0 0 12px rgba(0,255,255,0.6), inset 0 0 8px rgba(0,255,255,0.8);
    transition: width 0.3s ease-in-out;
    overflow: hidden; /* 约束伪元素溢出 */
    animation: neon-pulse 1.2s ease-in-out infinite;
}

/* 扫描光带（镜面扫光） */
.progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -35%;
    width: 35%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.75) 50%, transparent 100%);
    transform: skewX(-20deg);
    mix-blend-mode: screen;
    filter: blur(0.5px);
    animation: sweep 1.8s linear infinite;
}

/* 细密扫描线覆盖层 */
.progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(-45deg,
        rgba(255,255,255,0.14) 0 8px,
        rgba(255,255,255,0.03) 8px 16px);
    opacity: 0.35;
    mix-blend-mode: screen;
    animation: scan 6s linear infinite;
}

@keyframes neon-pulse {
  0%   { box-shadow: 0 0 8px rgba(0,255,255,0.45), inset 0 0 6px rgba(0,255,255,0.6); }
  50%  { box-shadow: 0 0 16px rgba(0,255,255,0.9), inset 0 0 10px rgba(0,255,255,0.95); }
  100% { box-shadow: 0 0 8px rgba(0,255,255,0.45), inset 0 0 6px rgba(0,255,255,0.6); }
}

@keyframes sweep {
  0% { left: -35%; }
  100% { left: 110%; }
}

@keyframes scan {
  0% { background-position: 0 0; }
  100% { background-position: 200% 0; }
}

/* UI Container */
.ui-container {
    position: relative;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allow clicks to pass through to canvas initially */
}

/* Header (Top Left) */
.top-left-header {
    position: absolute;
    top: 30px;
    left: 30px;
    pointer-events: auto; /* Enable interaction for header */
}

.top-left-header h1 {
    font-size: 1.8em;
    margin: 0;
    color: #ffffff;
    font-weight: 600;
    letter-spacing: 1px;
}

.top-left-header p {
    font-size: 0.9em;
    margin: 5px 0 0;
    color: #00ffff; /* Cyan subtitle */
    letter-spacing: 0.5px;
}

/* FPS Counter (Top Right) */
.top-right-fps {
    position: absolute;
    top: 30px;
    right: 30px;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 0.9em;
    pointer-events: auto;
}

.top-right-fps span {
    margin-left: 5px;
}

/* 科幻对话窗体样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease-out;
}

.modal-overlay.show {
    display: flex;
}

.modal-container {
    background: linear-gradient(135deg, rgba(0, 20, 40, 0.95), rgba(0, 40, 80, 0.95));
    border: 2px solid #00ffff;
    border-radius: 15px;
    box-shadow: 
        0 0 30px rgba(0, 255, 255, 0.3),
        inset 0 0 30px rgba(0, 255, 255, 0.1);
    width: 85vw;
    height: 85vh;
    overflow: hidden;
    position: relative;
    animation: modalSlideIn 0.4s ease-out;
}

.modal-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(0, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
    background: rgba(0, 255, 255, 0.05);
    position: relative;
    z-index: 1;
}

.modal-header h2 {
    color: #00ffff;
    margin: 0;
    font-size: 1.8em;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    letter-spacing: 1px;
}

.modal-close {
    background: none;
    border: 2px solid #00ffff;
    color: #00ffff;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.modal-close:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
    transform: scale(1.1);
}

.modal-content {
    display: flex;
    padding: 25px;
    gap: 25px;
    position: relative;
    z-index: 1;
    height: calc(85vh - 100px);
    overflow-y: auto;
}

.modal-text {
    flex: 1;
    color: #e0e0e0;
    display: flex;
    gap: 25px;
}

#modal-description {
    font-size: 1.1em;
    line-height: 1.8;
    color: #ffffff;
    text-align: justify;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    max-height: 100%;
}

.modal-left {
    flex: 0 0 25%;
    padding-right: 20px;
    border-right: 1px solid rgba(0, 255, 255, 0.3);
}

.modal-right {
    flex: 1;
    padding-left: 20px;
}

.modal-features {
    margin-bottom: 20px;
}

.modal-features h3 {
    color: #00ffff;
    font-size: 1.2em;
    margin-bottom: 15px;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.3);
}

.modal-features ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.modal-features li {
    padding: 12px 15px;
    border-left: 3px solid #00ffff;
    margin-bottom: 8px;
    background: rgba(0, 255, 255, 0.05);
    border-radius: 0 8px 8px 0;
    transition: all 0.3s ease;
    font-size: 0.95em;
}

.modal-features li:hover {
    background: rgba(0, 255, 255, 0.1);
    transform: translateX(5px);
}



/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .modal-container {
        width: 95vw;
        height: 90vh;
    }
    
    .modal-content {
        flex-direction: column;
        padding: 20px;
        height: calc(90vh - 100px);
    }
    
    .modal-text {
        flex-direction: column;
    }
    
    .modal-left {
        flex: none;
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid rgba(0, 255, 255, 0.3);
        padding-bottom: 20px;
        margin-bottom: 20px;
    }
    
    .modal-right {
        padding-left: 0;
    }
}

#fps-counter {
    color: #00ff00; /* Green FPS number */
    font-weight: bold;
}

/* Scene Container (for Three.js canvas) */
.scene-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Place canvas behind UI elements */
}

#main-canvas {
    display: block; /* Remove extra space below canvas */
    width: 100% !important; /* Ensure canvas fills container */
    height: 100% !important;
}

/* Bottom Left Controls */
.bottom-left-controls {
    position: absolute;
    bottom: 30px;
    left: 30px;
    font-size: 0.9em;
    pointer-events: auto;
}

.bottom-left-controls div {
    margin-bottom: 8px;
}

.bottom-left-controls input[type="checkbox"] {
    margin-right: 8px;
    accent-color: #00ffff; /* Cyan checkbox */
}

.bottom-left-controls label {
    cursor: pointer;
}

/* Footer (Bottom Center) */
.bottom-center-footer {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9em;
    pointer-events: auto;
}

.bottom-center-footer span, .bottom-center-footer a {
    margin: 0 15px;
    color: #a0a0a0;
    text-decoration: none;
}

.bottom-center-footer a:hover {
    color: #00ffff; /* Cyan on hover */
}

/* Spacecraft-themed legacy button */
.page-3d .bottom-center-footer .spacecraft-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px 10px 28px;
    color: #00ffff;
    text-decoration: none;
    border: 1px solid rgba(0,255,255,.5);
    border-radius: 20px 24px 24px 20px;
    background: linear-gradient(180deg, rgba(0,20,30,.75), rgba(0,8,12,.55));
    box-shadow: inset 0 0 14px rgba(0,255,255,.35), 0 0 20px rgba(0,255,255,.15);
    text-shadow: 0 0 8px rgba(0,255,255,.6);
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
    backdrop-filter: blur(2px);
}

.page-3d .bottom-center-footer .spacecraft-btn::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(0,255,255,.95), rgba(0,255,255,.45) 50%, rgba(0,255,255,.12) 72%);
    box-shadow: 0 0 14px rgba(0,255,255,.6), 0 0 26px rgba(0,255,255,.25);
    pointer-events: none;
}

.page-3d .bottom-center-footer .spacecraft-btn .cockpit {
    position: absolute;
    left: -10px;
    top: calc(50% - 10px);
    width: 20px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,.85), rgba(255,255,255,0) 65%);
    opacity: .35;
    filter: blur(.6px);
    animation: cockpitBlink 2s ease-in-out infinite;
    pointer-events: none;
}

.page-3d .bottom-center-footer .spacecraft-btn .thruster {
    position: absolute;
    right: -18px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 14px;
    background: radial-gradient(ellipse at left, rgba(0,255,255,.85), rgba(0,255,255,.25) 65%, rgba(0,255,255,0) 100%);
    filter: blur(1.2px);
    animation: thrust .9s ease-in-out infinite;
    pointer-events: none;
}

.page-3d .bottom-center-footer .spacecraft-btn:hover {
    transform: translateY(-1px);
    box-shadow: inset 0 0 18px rgba(0,255,255,.45), 0 0 24px rgba(0,255,255,.25);
    filter: saturate(1.15);
}

@keyframes thrust {
    0%, 100% { transform: translateY(-50%) scaleX(1) scaleY(1); opacity: .75; }
    50% { transform: translateY(-50%) scaleX(1.3) scaleY(1.1); opacity: 1; }
}

@keyframes cockpitBlink {
    0%, 100% { opacity: .25; }
    50% { opacity: .55; }
}

/* Earth-corner themed legacy button */
.page-3d .bottom-center-footer .earth-corner-btn{
  position:relative; display:inline-flex; align-items:center; gap:8px;
  padding:10px 22px 10px 34px; color:#bfeaff; text-decoration:none;
  border:1px solid rgba(0,180,255,.5); border-radius:16px 20px 20px 16px;
  background: linear-gradient(180deg, rgba(0,28,48,.85), rgba(0,12,24,.62));
  box-shadow: inset 0 0 14px rgba(0,180,255,.32), 0 0 18px rgba(0,180,255,.16);
  text-shadow: 0 0 8px rgba(0,210,255,.55);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
  backdrop-filter: blur(2px);
}
.page-3d .bottom-center-footer .earth-corner-btn:hover{ transform:translateY(-1px); box-shadow: inset 0 0 18px rgba(0,200,255,.45), 0 0 26px rgba(0,200,255,.22); filter:saturate(1.12); }
.page-3d .bottom-center-footer .earth-corner-btn .label{ position:relative; z-index:1; letter-spacing:.2px; }

.page-3d .bottom-center-footer .earth-corner-btn .earth-arc{
  position:absolute; left:-20px; top:50%; transform: translateY(-50%);
  width:36px; height:36px; border-radius:50%; pointer-events:none;
  background: radial-gradient(circle at 30% 30%, rgba(140,180,255,.95), rgba(0,80,160,.92) 50%, rgba(0,22,50,.85) 76%),
              radial-gradient(circle at 70% 90%, rgba(0,255,255,.45), rgba(0,255,255,0) 60%);
  box-shadow: 0 0 12px rgba(0,200,255,.35), 0 0 22px rgba(0,200,255,.15);
  mask: radial-gradient(closest-side, transparent 55%, #000 57%);
}
.page-3d .bottom-center-footer .earth-corner-btn .orbit-line{
  position:absolute; left:-18px; top:50%; transform: translateY(-50%) rotate(-10deg);
  width:42px; height:24px; border-top:1px solid rgba(255,255,255,.9);
  border-radius:40px; filter: drop-shadow(0 0 4px rgba(255,255,255,.6)); pointer-events:none;
}
.page-3d .bottom-center-footer .earth-corner-btn .satellite{
  position:absolute; left:-6px; top:50%; transform: translateY(-50%);
  width:6px; height:6px; border-radius:50%; background:#fff;
  box-shadow: 0 0 8px rgba(255,255,255,.7), 0 0 16px rgba(0,255,255,.55);
  animation: satelliteDrift 3.6s ease-in-out infinite; pointer-events:none;
}
@keyframes satelliteDrift{ 0%{ transform: translateY(-50%) translateX(0);} 50%{ transform: translateY(-62%) translateX(26px);} 100%{ transform: translateY(-50%) translateX(52px);} }

/* Bottom Right Controls */
.bottom-right-controls {
    position: absolute;
    bottom: 30px;
    right: 30px;
    display: flex;
    align-items: center;
    pointer-events: auto;
}

.bottom-right-controls button {
    background-color: rgba(0, 0, 0, 0.5);
    color: #e0e0e0;
    border: 1px solid #00ffff;
    padding: 8px 15px;
    margin-left: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s, color 0.3s;
}

.bottom-right-controls button:hover {
    background-color: #00ffff;
    color: #0a0a1f;
}

.bottom-right-controls button img {
    height: 16px;
    vertical-align: middle;
}

/* Node and Connection Styles (Conceptual - to be implemented in Three.js) */
.node-label {
    position: absolute;
    background-color: rgba(0, 20, 30, 0.8);
    color: #00ffff;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 0.8em;
    border: 1px solid #00ffff;
    transform: translate(-50%, -150%); /* Position above the node */
    white-space: nowrap;
    pointer-events: none; /* Labels should not be interactive */
    opacity: 0;
    transition: opacity 0.3s;
}

/* Info Panel Styles */
#info {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: #00ffff;
    font-family: 'Courier New', monospace;
    z-index: 100;
    pointer-events: none;
}

#info h1 {
    margin: 0;
    font-size: 1.25em; /* 缩小一点，提升整体协调度 */
    font-weight: bold;
    text-shadow: 0 0 10px #00ffff;
    letter-spacing: 2px;
}

#description {
    margin-top: 10px;
    font-size: 1em;
    opacity: 0.8;
    text-shadow: 0 0 5px #00ffff;
}

/* Responsive adjustments (optional) */
@media (max-width: 768px) {
    .top-left-header {
        font-size: 1.5em;
    }
    .top-left-header p {
        font-size: 0.8em;
    }
    .bottom-center-footer span, .bottom-center-footer a {
        margin: 0 8px;
        font-size: 0.8em;
    }
    .bottom-right-controls button {
        padding: 6px 10px;
        font-size: 0.8em;
    }
}

/* 主导航菜单 */
.main-menu {
    position: absolute;
    top: 20px; /* 初始放顶部，JS显示时会重设 */
    left: 50%; /* 预防闪烁，初始居中 */
    transform: translateX(-50%);
    display: none; /* 初始隐藏，showMainMenu 时显示 */
    display: flex; /* 作为弹性容器以启用 gap */
    gap: 12px; /* 稍微收紧间距，更像提示框按钮组 */
    padding: 8px 10px; /* 降低包裹层存在感 */
    border-radius: 12px;
    background: transparent; /* 容器不再上底色，避免整体“发灰” */
    z-index: 120;
    box-shadow: none; /* 去除外部发光，突出按钮自身 */
    border: none; /* 去除容器描边 */
}

/* 取消容器叠层特效，避免泛灰 */
.main-menu::before {
    content: none;
}

/* 采用提示框（hover-label）风格：深色半透明底 + 青色文字与描边 */
.main-menu .menu-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border-radius: 8px;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    border: 1px solid rgba(0,255,255,.6);
    background: rgba(0, 20, 30, 0.82) !important; /* 深色半透明底，参考提示框 */
    color: #00ffff; /* 与提示框一致的青色文字 */
    font-weight: 700;
    font-size: 16px;
    line-height: 1;
    letter-spacing: 0.4px;
    cursor: pointer;
    text-shadow: 0 0 6px rgba(0,255,255,.55); /* 提升亮度但不糊 */
    /* 移除会使底色变脏/发灰的效果 */
    box-shadow: none;
    -webkit-text-stroke: 0; /* 取消描边，参考提示框更干净 */
    transition: transform .18s ease, border-color .18s ease, background-color .18s ease, color .18s ease;
}

.main-menu .menu-item:hover {
    transform: translateY(-1px);
    border-color: rgba(0,255,255,.85);
    background: rgba(0, 28, 40, 0.9) !important; /* 悬停稍亮，仍保持深色 */
}

.main-menu .menu-item:active,
.main-menu .menu-item:focus {
    outline: none;
    transform: translateY(0);
    border-color: rgba(0,255,255,1);
}

/* 精简底部亮线，避免过亮干扰字体识别 */
.main-menu .menu-item::after {
    content: none;
}

/* 悬停提示标签样式优化为“展开菜单”用途 */
.hover-label {
    position: absolute;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(0, 20, 30, 0.85);
    color: #00ffff;
    border: 1px solid rgba(0,255,255,.4);
    box-shadow: 0 0 12px rgba(0,255,255,.25), inset 0 0 8px rgba(0,255,255,.15);
    pointer-events: none;
    white-space: nowrap;
    transform: translate(-50%, -120%);
    opacity: 0;
    transition: opacity .25s ease, transform .25s ease;
    z-index: 130;
}

/* Earth banner: full-width arc interactively grows into a giant earth */
.page-3d .earth-banner {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42vh;
  z-index: 20;
  pointer-events: auto;
}

.page-3d .earth-banner::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(160vh, 160vw);
  height: min(160vh, 160vw);
  transform: translateX(-50%) translateY(64vh) rotate(-10deg) scale(1);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 30%, rgba(150,190,255,0.95), rgba(32,98,180,0.98) 45%, rgba(6,40,95,0.96) 75%),
    radial-gradient(circle at 68% 92%, rgba(0,255,255,0.45), rgba(0,255,255,0) 62%);
  box-shadow:
    0 -14px 28px rgba(0,200,255,0.22),
    inset 0 0 34px rgba(0,200,255,0.25);
  filter: saturate(1.08);
  transition: transform 1.15s cubic-bezier(0.2, 0.8, 0, 1),
              filter 0.8s ease,
              box-shadow 0.8s ease;
}

.page-3d .earth-banner::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(172vh, 172vw);
  height: min(172vh, 172vw);
  transform: translateX(-50%) translateY(64vh) rotate(-10deg) scale(1);
  border-radius: 50%;
  box-shadow: 0 -30px 64px rgba(0,255,255,0.18);
  pointer-events: none;
  transition: transform 1.15s cubic-bezier(0.2, 0.8, 0, 1);
}

/* Earth banner: keep only a thin interactive strip for hover */
.page-3d .earth-banner { height: 14vh; }
/* 2D arc disabled above */

/* Permanently disable 2D arc overlay */
.page-3d .earth-banner::before,
.page-3d .earth-banner::after {
  display: none !important;
}

.page-3d .earth-banner .banner-label {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 8px 14px;
  color: #bfeaff;
  text-decoration: none;
  border: 1px solid rgba(0,255,255,0.45);
  border-radius: 12px;
  background: rgba(0,12,24,0.55);
  box-shadow: inset 0 0 12px rgba(0,200,255,0.25);
}

.page-3d .earth-banner:hover .banner-label,
.page-3d .earth-banner:focus .banner-label {
  filter: saturate(1.15);
}