/* 基础样式与变量设置 */
:root {
    --bg-color: #f5f5f7;
    --text-color: #333;
    --card-bg: #fff;
    --border-color: #e0e0e0;
    --purple: #7b61ff;
    --hover-color: #f0f0f5;
    --left-bg: #f0f0f5;
    --icon-color: #666;
    --gradient-start: #7b61ff;
    --gradient-end: #ff6b8b;
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #f0f0f0;
    --card-bg: #2c2c2c;
    --border-color: #444;
    --purple: #9d8aff;
    --hover-color: #383838;
    --left-bg: #2c2c2c;
    --icon-color: #ccc;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.main {
    display: flex;
    min-height: 100vh;
}

/* 左侧边栏样式 */
.left {
    width: 320px;
    background-color: var(--left-bg);
    padding: 30px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 10;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.left.active {
    transform: translateX(0);
}

.left-main {
    padding: 0 20px;
}

.logo {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    margin: 0 auto 30px;
    background-size: cover;
    background-position: center;
    border: 4px solid var(--card-bg);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.left-div {
    margin-bottom: 30px;
}

.left-div-item {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    color: var(--text-color);
}

.left-div-item svg {
    margin-right: 10px;
    fill: var(--icon-color);
}

.left-tag {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.left-tag-item {
    background-color: var(--card-bg);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.left-time ul {
    list-style: none;
    position: relative;
    padding-left: 25px;
}

.left-time ul::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--border-color);
}

.left-time li {
    position: relative;
    margin-bottom: 25px;
}

.focus {
    position: absolute;
    left: -25px;
    top: 5px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: var(--purple);
    border: 3px solid var(--left-bg);
}

/* 右侧主内容样式 */
.right {
    flex: 1;
    margin-left: 0;
    transition: margin-left 0.3s ease;
    /*
    ** 主要修改点：让内容向中间聚拢
    ** 1. 使用 padding 和 auto margin 结合 max-width 来实现居中效果
    ** 2. max-width: 1000px; 限制了内容的最大宽度，使其不会在超宽屏幕上过度拉伸
    ** 3. margin: 40px auto; 上下保持40px边距，左右自动，实现水平居中
    ** 4. padding: 0 40px; 在内容两侧保留一些内边距，使其不会紧贴容器边缘
    */
    max-width: 1000px; /* 关键改动 */
    margin: 40px auto;  /* 关键改动 */
    padding: 0 40px;    /* 关键改动 */
}

/* 调整大屏幕下的布局，确保左侧边栏和居中的右侧内容和谐共处 */
@media (min-width: 1344px) { /* 320px (left) + 1000px (right) + 24px (gap) */
    .main {
        /* 使用 padding 来为固定的侧边栏留出空间，而不是给 .right 设置 margin-left */
        padding-left: 320px;
    }
    .right {
        /* 在大屏幕上，移除 margin-left，因为 .main 的 padding-left 已经起到了作用 */
        margin-left: 0;
    }
}

/* 针对平板和小屏幕电脑的优化 */
@media (min-width: 1024px) and (max-width: 1343px) {
    .left {
        transform: translateX(0);
    }
    .right {
        /* 在中等屏幕上，为侧边栏留出空间 */
        margin-left: 320px;
        /* 同时适当减小 max-width，确保内容不会太拥挤 */
        max-width: calc(100% - 360px);
    }
}


/* 头部样式 */
.welcome {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.gradientText {
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.description {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-color);
}

.purpleText {
    color: var(--purple);
}

.textBackground {
    background-color: rgba(123, 97, 255, 0.1);
    padding: 0 5px;
    border-radius: 4px;
}

.music-player {
    margin: 25px 0;
}

/* 图标容器样式 */
.iconContainer {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 25px 0 35px;
    flex-wrap: wrap;
}

.iconItem, .iconItemLong {
    color: var(--icon-color);
    text-decoration: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    position: relative;
}

.iconItemLong {
    width: auto;
    padding: 0 15px;
    border-radius: 20px;
    gap: 8px;
}

.iconTip {
    font-size: 14px;
}

.iconItem:hover, .iconItemLong:hover {
    background-color: var(--hover-color);
    transform: translateY(-3px);
    color: var(--purple);
}

/* 切换按钮样式 */
.switch {
    margin-left: auto;
}

.onoffswitch {
    position: relative;
    width: 50px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.onoffswitch-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.onoffswitch-label {
    display: block;
    overflow: hidden;
    cursor: pointer;
    height: 24px;
    padding: 0;
    line-height: 24px;
    border: 0 solid #FFFFFF;
    border-radius: 30px;
    background-color: #9E9E9E;
}

.onoffswitch-inner {
    display: block;
    width: 200%;
    margin-left: -100%;
    transition: margin 0.3s ease-in 0s;
}

.onoffswitch-inner:before, .onoffswitch-inner:after {
    display: block;
    float: left;
    width: 50%;
    height: 24px;
    padding: 0;
    line-height: 24px;
    font-size: 14px;
    color: white;
    font-family: Trebuchet, Arial, sans-serif;
    font-weight: bold;
    box-sizing: border-box;
}

.onoffswitch-inner:before {
    content: "";
    padding-left: 10px;
    background-color: var(--purple);
    color: #FFFFFF;
}

.onoffswitch-inner:after {
    content: "";
    padding-right: 10px;
    background-color: #9E9E9E;
    color: #FFFFFF;
    text-align: right;
}

.onoffswitch-switch {
    display: block;
    width: 18px;
    margin: 3px;
    background: #FFFFFF;
    position: absolute;
    top: 0;
    bottom: 0;
    right: 26px;
    border: 0 solid #FFFFFF;
    border-radius: 30px;
    transition: all 0.3s ease-in 0s;
}

.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
    margin-left: 0;
}

.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
    right: 0px;
}

/* 标签按钮样式 */
.button-container {
    display: flex;
    gap: 10px;
    margin: 30px 0 25px;
    flex-wrap: wrap;
}

.tab-button {
    padding: 8px 20px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
}

.tab-button:hover {
    background-color: var(--hover-color);
}

.tab-button.but-active {
    background-color: var(--purple);
    color: white;
    border-color: var(--purple);
}

/* 内容区域样式 */
.tab-content {
    display: none;
    animation: fadeIn 0.5s;
}

.tab-content.content-active {
    display: block;
}

.title {
    display: flex;
    align-items: center;
    margin: 30px 0 20px;
    font-size: 1.4rem;
    font-weight: 600;
}

.title svg {
    margin-right: 10px;
    fill: var(--purple);
}

/* 项目列表样式 */
.projectList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.projectItem {
    display: flex;
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.projectItem:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.projectItemLeft {
    padding: 20px;
    flex: 1;
}

.projectItemLeft h1 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.projectItemLeft p {
    font-size: 0.9rem;
    color: #777;
}

.projectItemRight {
    width: 80px;
    background-color: var(--hover-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.projectItemRight img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

/* 技能展示样式 */
.skill {
    margin: 20px 0;
}

#skillWap {
    display: none;
}

@media (max-width: 768px) {
    #skillPc {
        display: none;
    }
    #skillWap {
        display: block;
    }
}

/* 介绍内容样式 */
.intro-content {
    background-color: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.intro-content p {
    margin-bottom: 15px;
}

.intro-ul {
    margin: 15px 0 25px 20px;
}

.intro-ul li {
    margin-bottom: 10px;
}

.highlight-link {
    color: var(--purple);
    text-decoration: none;
}

.highlight-link:hover {
    text-decoration: underline;
}

.highlight-text {
    color: var(--purple);
    font-weight: 500;
}

/* FAQ样式 */
.faq-container {
    background-color: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.faq-item {
    border-bottom: 1px solid var(--border-color);
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question {
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: 500;
}

.faq-question:hover {
    background-color: var(--hover-color);
}

.faq-arrow {
    transition: transform 0.3s;
    fill: var(--icon-color);
}

.faq-question.active .faq-arrow {
    transform: rotate(180deg);
}

.faq-answer {
    padding: 0 25px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s, padding 0.3s;
}

.faq-answer p {
    padding: 20px 0;
}

/* 页脚样式 */
footer {
    margin-top: 50px;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: #777;
    text-align: center;
}

.footer-links {
    color: var(--purple);
    text-decoration: none;
}

.footer-links:hover {
    text-decoration: underline;
}

/* 弹窗样式 */
.pop-up {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.pop-up.active {
    opacity: 1;
    visibility: visible;
}

.pop-up-main {
    max-width: 90%;
    max-height: 90%;
}

.pop-up-img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
}

.pop-up-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.pop-up-close:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

.pop-up-close svg {
    fill: white;
}

/* 响应式调整 */
@media (max-width: 1023px) {
    .main {
        /* 在小屏幕上，移除为侧边栏预留的 padding */
        padding-left: 0;
    }
    .right {
        padding: 30px 20px;
        margin: 20px auto; /* 减小上下边距 */
        max-width: 90%; /* 在手机上留出更多左右边距 */
    }
    
    .welcome {
        font-size: 2rem;
    }
    
    .projectList {
        grid-template-columns: 1fr;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 贪吃蛇图片样式 */
.tanChiShe {
    margin: 20px 0;
}

#tanChiShe {
    max-width: 100%;
    height: auto;
}