* {
    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;
    padding-top: 80px; /* 为固定导航栏预留出空间 */
}

/* 地球视频背景 */
.earth-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* 确保沉到最底层 */
    overflow: hidden;
}

#earthVideo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw; /* 撑满视窗宽度 */
    height: auto; /* 高度自适应 */
    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); */ /* 暂时禁用以调试层级BUG */
    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); */ /* 暂时禁用以调试层级BUG */
    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;
}

/* 导航栏按钮的新结构样式 */
.nav-toggle {
    display: none; /* 隐藏checkbox */
}

.nav-link {
    cursor: pointer;
}

/* 核心逻辑：当checkbox被选中时，显示它后面的菜单 */
#more-toggle:checked ~ .dropdown-menu,
#wechat-toggle:checked ~ .qr-code {
    display: block;
    opacity: 1;
    visibility: visible;
}

.nav-item > a, .nav-link {
    display: flex;
    align-items: center;
    color: #fff !important; /* 强制覆盖默认颜色 */
    text-decoration: none !important; /* 强制移除下划线 */
    padding: 10px 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

@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;
}

/* 头部微信二维码 */
.wechat-qr-header .qr-code {
    display: none;
    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;
}

/* 点击后，通过添加 .show-qr 类来显示 */
.wechat-qr-header.show-qr .qr-code {
    display: block;
    opacity: 1;
    visibility: visible;
}

@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;
    }
}

@keyframes glitch {
    0% { text-shadow: -2px -2px 0 #ff00c1, 2px 2px 0 #00fff9; clip-path: inset(20% 0 60% 0); }
    10% { clip-path: inset(40% 0 40% 0); }
    20% { clip-path: inset(60% 0 20% 0); }
    30% { clip-path: inset(80% 0 5% 0); }
    40% { clip-path: inset(10% 0 70% 0); }
    50% { clip-path: inset(50% 0 30% 0); }
    60% { clip-path: inset(30% 0 50% 0); }
    70% { clip-path: inset(0 0 90% 0); }
    80% { clip-path: inset(70% 0 10% 0); }
    90% { clip-path: inset(90% 0 0 0); }
    100% { text-shadow: 2px 2px 0 #ff00c1, -2px -2px 0 #00fff9; clip-path: inset(40% 0 40% 0); }
}

/* 主容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px; /* 调整顶部padding */
    position: relative;
}

.avatar-word-cloud-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: -75px; /* 向上拉，实现与导航栏的重叠 */
    margin-bottom: 40px;
    position: relative;
}

.avatar-container {
    position: relative;
    margin-bottom: -75px; /* 保持与下方内容的重叠关系 */
}

.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;
}

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

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

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

/* 词云说明 */
.word-cloud-tip {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-style: italic;
    text-shadow: 0 0 5px rgba(147, 112, 219, 0.5);
    text-align: center;
    margin-top: 20px; /* 放在词云下方 */
}

.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;
}

/* 标题区域 */
.hero-section {
    text-align: center;
    width: 100%;
    margin-top: -60px; /* 向上移动，实现与头像的轻微重叠 */
    padding-top: 60px; /* 增加内边距，防止文字被头像完全遮挡 */
    z-index: 5; /* 在头像之下 */
    position: relative;
}

.hero-title {
    font-size: 64px;
    font-weight: 700;
    margin-bottom: 25px;
    color: #fff;
    position: relative;
    text-shadow: 0 0 10px rgba(255,255,255,0.3), 0 0 20px rgba(147, 112, 219, 0.5);
}

.hero-title::before, .hero-title::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
}

.hero-title::before {
    left: 2px;
    text-shadow: -2px 0 #ff00c1;
    animation: glitch 3s infinite linear alternate-reverse;
}

.hero-title::after {
    left: -2px;
    text-shadow: -2px 0 #00fff9;
    animation: glitch 2s infinite linear alternate-reverse;
}

.hero-subtitle {
    font-size: 28px; /* 增大字体 */
    color: #fff;
    line-height: 1.6;
    max-width: 700px; /* 略微增加宽度以适应更大的字体 */
    margin: 0 auto;
    padding: 20px 30px; /* 增加内边距 */
    border: 1px solid #9370db;
    border-radius: 10px;
    background: linear-gradient(145deg, rgba(147, 112, 219, 0.1), rgba(255, 182, 193, 0.1));
    text-shadow: 0 0 5px #9370db, 0 0 10px #9370db;
    box-shadow: 0 0 15px rgba(147, 112, 219, 0.3), inset 0 0 10px rgba(147, 112, 219, 0.2);
    animation: breathing 3s ease-in-out infinite; /* 加快动画节奏 */
}

@keyframes breathing {
    0%, 100% {
        box-shadow: 0 0 15px rgba(147, 112, 219, 0.4), inset 0 0 10px rgba(147, 112, 219, 0.3);
        text-shadow: 0 0 5px #9370db, 0 0 10px #9370db;
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 182, 193, 0.7), inset 0 0 20px rgba(255, 182, 193, 0.5);
        text-shadow: 0 0 15px #ffb6c1, 0 0 25px #ffb6c1;
        transform: scale(1.02); /* 增加轻微的缩放效果 */
    }
}

/* 联系我 */
.contact-section {
    padding: 40px 0;
}

.contact-form {
    max-width: 700px;
    margin: 0 auto;
    padding: 30px 40px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    border: 1px solid rgba(147, 112, 219, 0.3);
    backdrop-filter: blur(10px);
}

.form-group {
    margin-bottom: 20px;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(147, 112, 219, 0.4);
    border-radius: 10px;
    color: #fff;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: #ffb6c1;
    box-shadow: 0 0 15px rgba(255, 182, 193, 0.5);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-submit-btn {
    display: block;
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(45deg, #9370db, #ffb6c1);
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 0 5px rgba(0,0,0,0.3);
}

.form-submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(147, 112, 219, 0.4);
}

#form-success-message {
    text-align: center;
    padding: 50px 40px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    border: 1px solid #9370db;
    color: #fff;
}

#form-success-message .fa-check-circle {
    font-size: 50px;
    color: #9370db;
    margin-bottom: 20px;
    animation: success-icon-pop 0.5s ease-out;
}

#form-success-message h3 {
    font-size: 24px;
    margin-bottom: 10px;
}

#form-success-message p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
}

@keyframes success-icon-pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* 技能展示 - 修复显示不全版本 */
.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);
    /* 新增：确保容器不隐藏内容 */
    overflow: visible;
    width: 100%;
}

.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效果提供视角 */
    /* 新增：确保网格容器占满宽度，不限制行数 */
    width: 100%;
    min-height: auto;
}

.skill-card-link {
    text-decoration: none;
    cursor: pointer;
    /* 新增：确保链接容器不隐藏卡片 */
    display: block;
    width: 100%;
    height: 100%;
}

/* 修复：原CSS里写的是.skill-card，但HTML里没有这个类，应该直接作用于链接内的card-inner */
.card-inner {
    position: relative;
    width: 100%;
    height: 280px; /* 微调高度，确保内容能显示完整 */
    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;
    /* 新增：防止卡片内容溢出 */
    overflow: visible;
}

.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;
    /* 新增：确保内容不被截断 */
    overflow: hidden;
}

.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;
    /* 新增：调整内边距，确保文字能换行显示 */
    word-wrap: break-word;
}

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

.card-back p {
    font-size: 14px;
    line-height: 1.6;
    /* 新增：确保文本自动换行，不溢出 */
    white-space: normal;
}

/* 修复：卡片正面的图标样式 */
.card-front i {
    font-size: 48px;
    margin-bottom: 20px;
    color: #9370db;
    text-align: center;
}

/* 修复：卡片正面的标题样式 */
.card-front h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #fff;
    text-align: center;
}

/* 移除无用的旧样式（避免冲突） */
.skill-icon, .skill-title, .skill-description {
    display: none;
}
/* 作品集展示 */
.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;
}

.breadcrumb {
    padding: 15px 0;
    background: rgba(0,0,0,0.4);
    color: #fff;
    position: fixed;
    top: 80px; /* Height of navbar */
    left: 0;
    right: 0;
    z-index: 1000;
    backdrop-filter: blur(5px);
    border-bottom: 1px solid rgba(147, 112, 219, 0.2);
}

.breadcrumb a {
    color: #ffb6c1;
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb a:hover {
    color: #fff;
    text-decoration: underline;
}

.breadcrumb span {
    color: rgba(255,255,255,0.7);
    margin-left: 8px;
}

.breadcrumb .nav-container span {
    margin-left: 8px;
}

/* 微信二维码 */
.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 {
        justify-content: flex-start; /* 从左侧开始排列 */
        padding: 10px 15px;
        overflow-x: auto; /* 允许横向滚动 */
        -webkit-overflow-scrolling: touch; /* 在iOS上实现平滑滚动 */
        scrollbar-width: none; /* Firefox隐藏滚动条 */
    }
    .nav-container::-webkit-scrollbar { 
        display: none; /* Chrome, Safari, Opera隐藏滚动条 */
    }
    .nav-item {
        flex-shrink: 0; /* 防止项目被压缩 */
        padding: 10px 15px;
        font-size: 16px;
    }
    .avatar-container {
        top: 90px; /* 调整位置，避免被导航栏遮挡 */
    }
    .word-cloud-container {
        width: 90vw; /* 宽度适应屏幕 */
        height: 60vw; /* 高度按比例调整 */
    }
    .footer-content {
        padding: 0 10px;
    }
    .contact-info {
        flex-direction: column; /* 垂直排列 */
        gap: 15px; /* 调整间距 */
        align-items: center;
    }
}
