/* ========================================= */
/* 主题变量 (同步自 style.css) */
/* ========================================= */
:root {
    --primary: #2ad4ff;
    --primary-dark: #1aa0c0;
    --dark: #02121c;
    --text: #e6f3ff;
    --text-muted: #9bb7d4;
    --card-bg: rgba(10, 40, 55, 0.7);
    --navbar-bg: rgba(2, 18, 28, 0.85);
    --border: rgba(255, 255, 255, 0.1);
}

/* ========================================= */
/* 导航栏切换按钮 */
/* ========================================= */
.nav-toggle-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.nav-toggle-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(1.05);
}

/* ========================================= */
/* 侧边导航栏 (大屏幕 - 默认左侧垂直) */
/* ========================================= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: var(--navbar-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--border);
    padding: 80px 30px 30px 30px; /* 顶部留出空间给 Toggle 按钮 */
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    transform: translateX(0); /* 默认显示 */
}

/* 隐藏状态 */
.sidebar.hidden {
    transform: translateX(-100%);
}

/* ========================================= */
/* Logo 样式及动效 (完全同步自 style.css) */
/* ========================================= */
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    margin-bottom: 50px;
    /* 添加平滑过渡效果 */
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), text-shadow 0.3s ease;
}

/* 🌟 1. 鼠标悬浮时整体放大并产生微光 */
.logo:hover {
    transform: scale(1.05) translateY(-2px);
    text-shadow: 0 4px 12px rgba(42, 212, 255, 0.4);
}

/* 🌟 2. 给 Emoji 图标添加上下浮动的呼吸动画 */
.logo-icon { 
    font-size: 1.8rem; 
    display: inline-block; /* 必须是 inline-block 才能让 transform 动画生效 */
    animation: iconFloat 3.5s ease-in-out infinite; /* 无限循环浮动 */
}

.logo-highlight { 
    color: var(--primary); 
    margin-left: 4px; 
    transition: text-shadow 0.3s ease;
}

/* 鼠标悬浮时高亮文字发光更强 */
.logo:hover .logo-highlight {
    text-shadow: 0 0 15px var(--primary);
}

/* 🌟 3. 定义浮动关键帧动画 */
@keyframes iconFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-6px) rotate(5deg); /* 向上浮动并带有轻微的摇摆 */
    }
}

/* 链接垂直排版 */
.nav-links {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary);
    transform: translateX(8px); /* 悬停右移小动效 */
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.nav-link:hover::after, .nav-link.active::after {
    width: 20px; /* 激活时显示的短横线指示器 */
}

/* ========================================= */
/* 移动端导航栏 (小屏幕 - 顶部水平) */
/* ========================================= */
@media (max-width: 768px) {
    .nav-toggle-btn {
        top: 12px;
        left: auto;
        right: 16px; /* 移动端按钮放在右上角 */
    }

    .sidebar {
        width: 100vw;
        height: auto;
        padding: 16px 60px 16px 20px; /* 右侧留空给按钮 */
        flex-direction: column;
        border-right: none;
        border-bottom: 1px solid var(--border);
        /* 修改隐藏方向为从顶部滑出 */
        transform: translateY(0); 
    }

    .sidebar.hidden {
        transform: translateY(-100%);
    }

    .logo {
        margin-bottom: 16px;
        font-size: 1.3rem;
    }

    /* 移动端链接水平排列，允许横向滑动 */
    .nav-links {
        flex-direction: row;
        width: 100%;
        overflow-x: auto;
        gap: 20px;
        padding-bottom: 8px;
        scrollbar-width: none; /* Firefox 隐藏滚动条 */
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-links::-webkit-scrollbar {
        display: none; /* Chrome/Safari 隐藏滚动条 */
    }

    .nav-link {
        white-space: nowrap; /* 防止文字换行 */
        font-size: 1rem;
    }

    .nav-link:hover, .nav-link.active {
        transform: translateX(0); /* 取消移动端的右移动效 */
    }
}

/* 清除默认样式 */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* 隐藏滚动条 */
    background-color: #f0f0f0; /* 网页背景色，可根据需要修改 */
}

/* 3D 容器撑满全屏 */
#canvas-container {
    width: 100vw;
    height: 100vh;
    display: block;
}

/* ========================================= */
/* 3D 交互面板样式 (由 JS 动态生成) */
/* ========================================= */

/* 1. 鼠标悬浮提示框 */
#hover-info {
    position: absolute;
    background: var(--card-bg, rgba(10, 40, 55, 0.7)); 
    backdrop-filter: blur(12px);
    padding: 12px 24px;
    border-radius: 30px;
    color: var(--text, #e6f3ff); 
    font-family: 'Inter', sans-serif; 
    font-size: 15px;
    font-weight: 500;
    pointer-events: none;
    z-index: 100;
    border-left: 4px solid var(--primary, #2ad4ff);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
    display: none; /* 初始隐藏 */
}

.hover-icon {
    margin-right: 10px;
}

#hover-atoll-name {
    font-weight: 600;
}

/* 2. 右侧详细图文面板 */
#detail-panel {
    position: fixed;
    right: -400px; /* 初始藏在屏幕右侧外面 */
    top: 50%;
    transform: translateY(-50%);
    width: 320px;
    background: var(--card-bg, rgba(10, 40, 55, 0.85));
    backdrop-filter: blur(20px);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
    border-radius: 20px;
    padding: 24px;
    color: var(--text, #e6f3ff);
    font-family: 'Inter', sans-serif;
    box-shadow: -10px 10px 40px rgba(0, 0, 0, 0.5);
    transition: right 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 200;
    pointer-events: auto;
}

/* 🌟 JS 会通过添加这个 class 来触发面板弹出 */
#detail-panel.show {
    right: 20px; 
}

/* 3. 关闭按钮 */
#close-detail-btn {
    position: absolute; 
    top: 12px; 
    right: 12px; 
    width: 36px; 
    height: 36px; 
    border-radius: 50%; 
    background: rgba(0, 0, 0, 0.6); 
    border: 1px solid rgba(255, 255, 255, 0.3); 
    color: #ffffff; 
    font-size: 24px; 
    line-height: 1;
    display: flex; 
    align-items: center; 
    justify-content: center;
    cursor: pointer; 
    opacity: 1;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); 
    z-index: 10;
    transition: all 0.2s ease;
}

#close-detail-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 4. 面板内部图片与文字排版 */
.detail-img-container {
    border-radius: 12px; 
    overflow: hidden; 
    margin-bottom: 16px; 
    border: 1px solid rgba(255,255,255,0.1);
}

#detail-img {
    width: 100%; 
    height: 180px; 
    object-fit: cover; 
    display: block;
}

#detail-title {
    margin: 0 0 10px 0; 
    font-size: 22px; 
    color: var(--primary, #2ad4ff);
}

#detail-desc {
    font-size: 14px; 
    line-height: 1.6; 
    color: var(--text-muted, #9bb7d4); 
    margin: 0;
}

/* ========================================= */
/* 悬浮 IP 角色容器 */
/* ========================================= */
/* 悬浮 IP 角色容器 */
#ip-container {
    position: fixed;
    z-index: 1002;
    /* 重点：将 none 改为 auto，允许鼠标与 IP 交互 */
    pointer-events: auto; 
}

/* 💻 桌面端大屏幕 (宽度大于 768px) */
@media (min-width: 769px) {
    #ip-container {
        bottom: 17px; 
        width: 300px;  /* 🌟 从 200px 调大到 300px，给模型更多空间 */
        height: 400px; /* 🌟 从 200px 调大到 300px */
        transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
    }

    /* ✨ 魔法代码：当 #main-nav 有 hidden 类时，它后面的 #ip-container 也跟着向左移出并变透明 */
    #main-nav.hidden ~ #ip-container {
        transform: translateX(-150%);
        opacity: 0;
    }
}

/* 📱 移动端小屏幕 (宽度小于等于 768px) */
@media (max-width: 768px) {
    #ip-container {
        bottom: 10px;
        left: 10px;
        width: 140px; /* 🌟 从 100px 调大到 140px */
        height: 140px; /* 🌟 从 100px 调大到 140px */
        transform: none !important;
        opacity: 1 !important;
    }
}


/* ============================== */
/* 👇 IP 聊天气泡样式 👇 */
/* ============================== */

/* 1. 气泡整体容器 */
#ip-chat-bubble {
    position: absolute; 
    
    /* 👇 主要修改这里：调整位置到右上方 👇 */
    bottom: 75%;        /* 提高整体高度，让它处于 IP 头部附近 */
    left: 65%;          /* 从容器左侧往右推，让它出现在 IP 右侧 */
    right: auto;        /* 清除之前的 right 设置 */
    
    /* 以下保持不变 */
    background: rgba(0, 20, 30, 0.85); 
    border: 2px solid #00f3ff;         
    color: #00f3ff;                    
    padding: 10px 18px;
    border-radius: 15px;               
    font-family: 'PingFang SC', sans-serif; 
    font-size: 14px;
    white-space: nowrap;               
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.5); 
    z-index: 1003; 
    opacity: 0;                        
    transform: translateY(15px) scale(0.8); 
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none; 
}

/* 3. 气泡显示时的状态类 (由 JS 添加/移除) */
#ip-chat-bubble.show {
    opacity: 1;                       /* 完全显示 */
    transform: translateY(0px) scale(1); /* 恢复原位和大小 */
    
    /* 显示时，可以根据需要决定是否允许点击气泡本身。
       因为是悬停触发，建议保持 none，不阻挡鼠标事件。 */
    pointer-events: none;
}

/* 4. 气泡内容样式 */
.bubble-content {
    font-weight: bold;
    letter-spacing: 1px;
}

/* 5. 气泡小箭头 */
.bubble-arrow {
    position: absolute;
    bottom: -10px;   /* 箭头底部距离气泡底部保持不变 */
    
    /* 👇 主要修改这里：让箭头靠左 👇 */
    left: 15px;      /* 将箭头移到气泡偏左的位置，指向左下方的 IP */
    
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 10px solid #00f3ff; 
}

/* 内部箭头遮罩 (保持原样即可) */
.bubble-arrow::after {
    content: "";
    position: absolute;
    bottom: 3px;     
    left: -8px;      
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 10px solid rgba(0, 20, 30, 0.95); 
}