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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0a0a0a, #1a1a2e, #16213e);
    color: #fff;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* 地球视频背景 */
.earth-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

#earthVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.3;
}

/* 星空背景 */
#stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* 导航栏 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(15px);
    z-index: 1001;
    border-bottom: 1px solid rgba(147, 112, 219, 0.3);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center; /* 确保内容水平居中 */
    height: 80px;
    gap: 30px;
    position: relative;
    z-index: 1;
}

.nav-item {
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 30px;
    transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    background: rgba(147, 112, 219, 0.2);
    border: 1px solid rgba(147, 112, 219, 0.3);
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(147, 112, 219, 0.2), transparent);
    transition: left 0.6s ease;
}

.nav-item:hover::before {
    left: 100%;
}

.nav-item:hover, .dropdown:hover {
    color: #9370db;
    background: rgba(147, 112, 219, 0.1);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(147, 112, 219, 0.3);
}
.nav-item:active, .dropdown:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 4px 15px rgba(147, 112, 219, 0.2);
}

/* 下拉菜单样式 */
.dropdown {
    position: relative;
    cursor: pointer;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 20, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 10px;
    border: 1px solid rgba(147, 112, 219, 0.4);
    width: 220px;
    z-index: 1002;
    opacity: 0;
    visibility: hidden;
    transform-origin: top center;
    animation: dropdown-fade 0.3s ease-out forwards;
}

.dropdown.open .dropdown-menu {
    display: block;
    visibility: visible;
    opacity: 1;
}

@keyframes dropdown-fade {
    from {
        opacity: 0;
        transform: translateX(-50%) scaleY(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) scaleY(1);
    }
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
    transition: background-color 0.2s ease;
    font-size: 16px;
}

.dropdown-item:hover {
    background-color: rgba(147, 112, 219, 0.2);
}

.dropdown-item i {
    width: 20px;
    text-align: center;
    color: #9370db;
}

/* 已访问链接状态 */
.nav-item.visited, .dropdown-item.visited {
    background-color: rgba(80, 60, 150, 0.3) !important;
    color: rgba(255, 255, 255, 0.6) !important;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}
.nav-item.visited:hover, .dropdown-item.visited:hover {
    color: #fff !important;
}
.word.visited {
    color: #6a5acd !important;
    text-shadow: none !important;
}

/* 个人头像 */
.avatar-container {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.5s ease;
}

.avatar-container.sidebar {
    left: 20px;
    top: 100px;
}

.avatar-container.sidebar-right {
    left: calc(100% - 170px);
    top: 100px;
}

.avatar-container.sidebar .avatar {
    width: 80px;
    height: 80px;
}

.avatar-container.sidebar-right .avatar {
    width: 80px;
    height: 80px;
}

.avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 3px solid #9370db;
    box-shadow: 0 0 30px rgba(147, 112, 219, 0.6);
    cursor: pointer;
    transition: all 0.3s ease;
    object-fit: cover;
    position: relative;
    z-index: 1002;
}

.avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 0 40px rgba(147, 112, 219, 0.8);
}

.avatar-container.sidebar,
.avatar-container.sidebar-right {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.5) translateY(-30px); /* 增加向上移动的效果 */
}

.avatar-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.word-cloud-tip {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-style: italic;
    margin-top: 15px;
    text-shadow: 0 0 5px rgba(147, 112, 219, 0.5);
}

/* 头部微信二维码 */
.wechat-qr-header {
    position: relative;
}

.wechat-qr-header:hover .qr-code {
    display: block;
    opacity: 1;
    visibility: visible;
}

.wechat-qr-header .qr-code {
    display: block; /* 初始为block以应用动画 */
    opacity: 0;
    visibility: hidden;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 10px;
    padding: 10px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1002;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* 词云容器 */
.word-cloud-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 450px; /* 增大宽度 */
    height: 250px; /* 增大高度 */
    z-index: 1001;
    overflow: visible;
}

.word {
    position: absolute;
    top: 50%;
    left: 50%;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 0 10px rgba(147, 112, 219, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1001;
}

.word.behind {
    z-index: 999;
    opacity: 0.5;
}

.word:hover {
    color: #9370db;
    transform: scale(1.2);
}

.word.mutant {
    color: #ff6b6b;
    animation: mutantPulse 2s ease-in-out infinite;
}

@keyframes mutantPulse {
    0%, 100% {
        text-shadow: 0 0 10px #ff6b6b, 0 0 20px #ff6b6b;
    }
    50% {
        text-shadow: 0 0 20px #ff6b6b, 0 0 30px #ff6b6b, 0 0 40px #ff6b6b;
    }
}

/* 主容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 280px 20px 60px;
    position: relative;
    z-index: 3;
}

/* 标题样式 */
.hero-section {
    text-align: center;
    margin-bottom: 60px;
    padding: 40px 20px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    border: 1px solid rgba(147, 112, 219, 0.3);
    backdrop-filter: blur(10px);
}

.hero-title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 20px;
    background: linear-gradient(45deg, #9370db, #ffb6c1, #add8e6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from {
        filter: drop-shadow(0 0 10px rgba(147, 112, 219, 0.5));
    }
    to {
        filter: drop-shadow(0 0 20px rgba(147, 112, 219, 0.8));
    }
}

.hero-subtitle {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 30px;
    line-height: 1.6;
}

/* 技能展示 */
.skills-section {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    border: 1px solid rgba(147, 112, 219, 0.3);
    padding: 30px;
    margin-bottom: 60px;
    backdrop-filter: blur(10px);
}

.section-title {
    font-size: 36px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 40px;
    color: #9370db;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, #9370db, #ffb6c1);
    border-radius: 2px;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    perspective: 1000px; /* 为子元素的3D效果提供视角 */
}

.skill-card-link {
    text-decoration: none;
    cursor: pointer;
}

.skill-card {
    background: transparent; /* 卡片本身透明 */
    border-radius: 15px;
    border: none;
    transition: all 0.3s ease;
    position: relative;
    height: 250px; /* 固定高度以便翻转 */
    transform-style: preserve-3d; /* 允许3D变换 */
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.7s cubic-bezier(0.7, 0, 0.3, 1);
    transform-style: preserve-3d;
    box-shadow: 0 10px 25px rgba(0,0,0, 0.3);
    border-radius: 15px;
}

.skill-card-link:hover .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden; /* Safari */
    backface-visibility: hidden;
    border-radius: 15px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.card-front {
    background: rgba(20, 20, 40, 0.7);
    border: 1px solid rgba(147, 112, 219, 0.3);
    color: white;
}

.card-back {
    background: linear-gradient(135deg, #9370db, #6a5acd);
    color: white;
    transform: rotateY(180deg);
    padding: 20px;
}

.card-back h3 {
    font-size: 20px;
    margin-bottom: 10px;
}

.card-back p {
    font-size: 14px;
    line-height: 1.6;
}

.skill-icon {
    font-size: 48px;
    margin-bottom: 20px;
    color: #9370db;
    text-align: center;
}

.skill-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #fff;
    text-align: center;
}

.skill-description {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    text-align: center;
}

/* 作品集展示 */
.portfolio-section {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    border: 1px solid rgba(147, 112, 219, 0.3);
    padding: 30px;
    margin-bottom: 60px;
    backdrop-filter: blur(10px);
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.portfolio-item {
    background: rgba(20, 20, 40, 0.6);
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid rgba(147, 112, 219, 0.3);
    transition: all 0.3s ease;
}

.portfolio-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(147, 112, 219, 0.4);
    border-color: rgba(147, 112, 219, 0.6);
}

.portfolio-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: all 0.3s ease;
}

.portfolio-item:hover .portfolio-image {
    transform: scale(1.1);
}

.portfolio-content {
    padding: 20px;
}

.portfolio-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #fff;
}

.portfolio-description {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 15px;
    line-height: 1.6;
}

.portfolio-link {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(45deg, #9370db, #6a5acd);
    color: #fff;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.portfolio-link:hover {
    background: linear-gradient(45deg, #6a5acd, #9370db);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(147, 112, 219, 0.4);
}

/* 页脚 */
.footer {
    background: rgba(0, 0, 0, 0.8);
    border-top: 1px solid rgba(147, 112, 219, 0.3);
    padding: 40px 0;
    margin-top: 60px;
    position: relative;
    z-index: 3;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.footer-text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    margin-bottom: 20px;
}

.contact-info {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

.contact-item {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s ease;
    position: relative;
}

.contact-item:hover {
    color: #9370db;
}

/* 微信二维码 */
.wechat-qr {
    position: relative;
}

.wechat-qr:hover .qr-code {
    display: block;
}

.qr-code {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 10px;
    padding: 10px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1002;
}

.qr-code img {
    width: 150px;
    height: 150px;
}

/* 彩蛋弹窗 */
.easter-egg-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.easter-egg-content {
    background: rgba(20, 20, 40, 0.9);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    border: 2px solid #9370db;
    box-shadow: 0 0 30px rgba(147, 112, 219, 0.6);
    max-width: 500px;
    width: 90%;
}

.easter-egg-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #9370db;
}

.easter-egg-message {
    font-size: 18px;
    color: #fff;
    margin-bottom: 30px;
    line-height: 1.6;
}

@keyframes twinkle {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

@keyframes move {
    0% {
        transform: translateX(0) translateY(0);
    }
    100% {
        transform: translateX(-20%) translateY(0);
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-wrap: nowrap; /* 禁止换行 */
        overflow-x: auto; /* 允许横向滚动 */
        justify-content: flex-start; /* 从左侧开始排列 */
        height: auto;
        padding: 15px 20px;
        gap: 10px;
    }
}
