/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #ffffff url('leaves.webp') repeat;
    background-size: 200px 200px;
    background-attachment: fixed;
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 移动端触摸优化 */
* {
    -webkit-tap-highlight-color: transparent;
}

button, .toggle-btn, .device-card, .link-card {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* 移动端整体优化 */
html, body {
    overflow-x: hidden;
    width: 100%;
}

/* 确保移动端背景图正确显示 */
@media (max-width: 768px) {
    body {
        background-attachment: scroll;
        background-position: center top;
    }
}

/* 移动端滚动优化 */
.content-section {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* 防止移动端双击缩放 */
.device-card img,
.link-card img {
    pointer-events: none;
}

/* 移动端按钮触摸优化 */
.toggle-btn {
    min-height: 44px;
    min-width: 44px;
}

/* 移动端卡片触摸优化 */
.device-card,
.link-card {
    min-height: 44px;
    cursor: pointer;
}

/* 叶子背景装饰 - 增强叶子图案效果 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(78, 205, 196, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(120, 219, 255, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(78, 205, 196, 0.1) 0%, transparent 50%);
    z-index: -1;
    animation: backgroundShift 15s ease-in-out infinite;
}

/* 支持条状图片背景 */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: var(--stripes-pattern, url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="stripes" width="20" height="20" patternUnits="userSpaceOnUse"><line x1="0" y1="0" x2="20" y2="20" stroke="rgba(78,205,196,0.15)" stroke-width="1.5"/><line x1="20" y1="0" x2="0" y2="20" stroke="rgba(78,205,196,0.15)" stroke-width="1.5"/></pattern></defs><rect width="100" height="100" fill="url(%23stripes)"/></svg>'));
    background-size: 20px 20px;
    z-index: -1;
    opacity: var(--stripes-opacity, 0.4);
    animation: stripesMove 30s linear infinite;
}

@keyframes backgroundShift {
    0%, 100% { 
        transform: scale(1) rotate(0deg); 
        opacity: 0.8;
    }
    25% { 
        transform: scale(1.2) rotate(2deg); 
        opacity: 1;
    }
    50% { 
        transform: scale(1.15) rotate(-1deg); 
        opacity: 0.9;
    }
    75% { 
        transform: scale(1.1) rotate(1deg); 
        opacity: 1;
    }
}

@keyframes stripesMove {
    0% { background-position: 0 0; }
    100% { background-position: 40px 40px; }
}

/* 主容器 */
.container {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    width: 100%;
    max-width: 1400px;
    margin: 2rem auto;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

/* 浮动粒子效果 */
.floating-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--particles-color, rgba(78, 205, 196, 0.9));
    border-radius: 50%;
    animation: particleFloat 8s linear infinite;
    box-shadow: 0 0 20px var(--particles-color, rgba(78, 205, 196, 0.8));
    filter: blur(0.5px);
}

.particle:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
    animation-duration: 8s;
}

.particle:nth-child(2) {
    left: 20%;
    animation-delay: 2s;
    animation-duration: 10s;
}

.particle:nth-child(3) {
    left: 30%;
    animation-delay: 4s;
    animation-duration: 12s;
}

.particle:nth-child(4) {
    left: 70%;
    animation-delay: 1s;
    animation-duration: 9s;
}

.particle:nth-child(5) {
    left: 80%;
    animation-delay: 3s;
    animation-duration: 11s;
}

.particle:nth-child(6) {
    left: 90%;
    animation-delay: 5s;
    animation-duration: 7s;
}

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* 左侧装饰元素 */
.container::after {
    content: '✦';
    position: absolute;
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    color: rgba(78, 205, 196, 0.8);
    animation: floatLeft 4s ease-in-out infinite;
    z-index: 1;
    text-shadow: 0 0 15px rgba(78, 205, 196, 0.6);
}

/* 右侧装饰元素 */
.container::before {
    content: '✦';
    position: absolute;
    right: -30px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    color: rgba(120, 219, 255, 0.8);
    animation: floatRight 4s ease-in-out infinite;
    z-index: 1;
    text-shadow: 0 0 15px rgba(120, 219, 255, 0.6);
}

@keyframes floatLeft {
    0%, 100% { 
        transform: translateY(-50%) translateX(0px) scale(1); 
        opacity: 0.7; 
    }
    50% { 
        transform: translateY(-50%) translateX(-15px) scale(1.1); 
        opacity: 1; 
    }
}

@keyframes floatRight {
    0%, 100% { 
        transform: translateY(-50%) translateX(0px) scale(1); 
        opacity: 0.7; 
    }
    50% { 
        transform: translateY(-50%) translateX(15px) scale(1.1); 
        opacity: 1; 
    }
}

/* 左侧个人介绍区域 */
.profile-section {
    flex: 0 0 20%;
    width: 20%;
    min-width: 200px;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    z-index: 10;
}

.profile-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.profile-card {
    position: relative;
    z-index: 1;
    text-align: center;
}

.avatar-container {
    margin-bottom: 1rem;
}

.avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
}

.name {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #ecf0f1;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    background: linear-gradient(45deg, #ecf0f1, #78cdc4, #78dfff, #ecf0f1);
    background-size: 300% 300%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: typing 2s steps(20, end) 0.5s forwards, gradient-shift 3s ease-in-out infinite 2.5s;
    text-shadow: 0 0 20px rgba(78, 205, 196, 0.5);
    filter: drop-shadow(0 0 10px rgba(120, 219, 255, 0.3));
}

/* 完成打字机效果后的状态 */
.name.typing-complete {
    width: 100%;
    animation: gradient-shift 3s ease-in-out infinite;
}

/* 打字机效果 */
@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}



/* 渐变色彩变化 */
@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 名称悬停效果 - 只在完成打字机效果后生效 */
.name.typing-complete:hover {
    background: linear-gradient(45deg, #78cdc4, #78dfff, #ecf0f1, #78cdc4);
    background-size: 300% 300%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shift 1.5s ease-in-out infinite, glow-pulse 1s ease-in-out infinite;
    transform: scale(1.05);
    text-shadow: 0 0 30px rgba(78, 205, 196, 0.8);
    filter: drop-shadow(0 0 15px rgba(120, 219, 255, 0.6));
}

/* 发光脉冲效果 */
@keyframes glow-pulse {
    0%, 100% { 
        text-shadow: 0 0 20px rgba(78, 205, 196, 0.5);
        filter: drop-shadow(0 0 10px rgba(120, 219, 255, 0.3));
    }
    50% { 
        text-shadow: 0 0 40px rgba(78, 205, 196, 0.9);
        filter: drop-shadow(0 0 20px rgba(120, 219, 255, 0.8));
    }
}

/* 震动效果 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

.bio {
    margin-bottom: 2rem;
    line-height: 1.6;
    color: #ecf0f1;
}

.contact-info {
    text-align: left;
}

.contact-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.3rem;
    padding: 0.3rem;
    transition: all 0.3s ease;
    word-wrap: break-word;
}

/* 移动端联系信息居中显示 */
@media (max-width: 768px) {
    .contact-info {
        text-align: center;
    }
    
    .contact-item {
        justify-content: center;
    }
}

.contact-item:hover {
    transform: translateX(5px);
}

.contact-text {
    word-wrap: break-word;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* 右侧内容区域 */
.content-section {
    flex: 1;
    width: 80%;
    padding: 1.5rem;
    background: #f8f9fa;
    overflow-y: auto;
}

.toggle-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.toggle-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 25px;
    background: #e9ecef;
    color: #6c757d;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.toggle-btn:hover {
    background: #dee2e6;
    transform: translateY(-2px);
}

.toggle-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.content-area {
    animation: fadeIn 0.5s ease;
}

.content-area.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.content-area h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #2c3e50;
    text-align: center;
    position: relative;
}

.content-area h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

/* 设备库样式 */
.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.device-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.device-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.device-image {
    height: 200px;
    overflow: hidden;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.device-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.device-card:hover .device-image img {
    transform: scale(1.05);
}

.device-info {
    padding: 1.5rem;
}

.device-info h3 {
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
    color: #2c3e50;
}

.device-desc {
    color: #6c757d;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.purchase-date {
    font-size: 0.9rem;
    color: #868e96;
    margin-bottom: 0.5rem;
}

/* 友链网站样式 */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.link-card {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.link-icon {
    font-size: 3rem;
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.link-icon-img {
    width: 3rem;
    height: 3rem;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.link-info h3 {
    font-size: 1.4rem;
    margin-bottom: 0.8rem;
    color: #2c3e50;
}

.link-info p {
    color: #6c757d;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.link-url {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* 页脚样式 */
.footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-top: 1px solid rgba(78, 205, 196, 0.2);
    padding: 0.8rem 0;
    margin-top: 3rem;
    text-align: center;
    position: relative;
    z-index: 10;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(78, 205, 196, 0.5), transparent);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-text p {
    margin: 0.3rem 0;
    color: #2c3e50;
    font-weight: 500;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        margin: 1rem auto;
        border-radius: 15px;
        min-height: auto;
        width: calc(100% - 2rem);
        max-width: none;
    }
    
    .profile-section {
        flex: 0 0 auto;
        width: 100%;
        padding: 1rem;
        min-width: auto;
    }
    
    .content-section {
        width: 100%;
        padding: 1rem;
    }
    
    .devices-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .links-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .link-card {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }
    
    .toggle-buttons {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .toggle-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }
    
    /* 隐藏装饰元素 */
    .container::before,
    .container::after {
        display: none;
    }
    
    /* 优化移动端触摸体验 */
    .device-card,
    .link-card {
        touch-action: manipulation;
    }
    
    /* 调整头像大小 */
    .avatar {
        width: 120px;
        height: 120px;
    }
    
    /* 调整名字大小和动画 */
    .name {
        font-size: 1.6rem;
        animation: typing 1.8s steps(20, end) 0.5s forwards, gradient-shift 2.5s ease-in-out infinite 2.3s;
        overflow: hidden;
        white-space: nowrap;
        width: 0;
    }
    
    /* 移动端优化悬停效果 */
    .name.typing-complete:hover {
        transform: scale(1.03);
    }
    
    /* 调整内容标题 */
    .content-area h2 {
        font-size: 1.8rem;
    }
    
    /* 确保背景图完整显示 */
    body {
        background-attachment: scroll;
        background-size: 150px 150px;
    }
    
    /* 优化容器透明度，让背景更明显 */
    .container {
        background: rgba(255, 255, 255, 0.95);
    }
    
    /* 移动端布局优化 */
    .profile-section,
    .content-section {
        border-radius: 10px;
        margin-bottom: 0.5rem;
    }
    
    /* 移动端联系信息间距优化 */
    .contact-item {
        margin-bottom: 0.2rem;
        padding: 0.2rem;
    }
}

@media (max-width: 480px) {
    .container {
        margin: 0.5rem auto;
        border-radius: 10px;
        width: calc(100% - 1rem);
    }
    
    /* 进一步优化背景图显示 */
    body {
        background-size: 120px 120px;
    }
    
    .profile-section {
        padding: 0.8rem;
    }
    
    .content-section {
        padding: 0.8rem;
    }
    
    .name {
        font-size: 1.4rem;
        animation: typing 1.5s steps(20, end) 0.5s forwards, gradient-shift 2s ease-in-out infinite 2s;
        overflow: hidden;
        white-space: nowrap;
        width: 0;
    }
    
    /* 小屏幕优化悬停效果 */
    .name.typing-complete:hover {
        transform: scale(1.02);
    }
    
    .avatar {
        width: 100px;
        height: 100px;
    }
    
    .bio {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }
    
    .contact-text {
        font-size: 0.8rem;
    }
    
    .content-area h2 {
        font-size: 1.4rem;
        margin-bottom: 1.5rem;
    }
    
    .toggle-buttons {
        gap: 0.3rem;
    }
    
    .toggle-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .devices-grid,
    .links-grid {
        gap: 0.8rem;
    }
    
    .device-card,
    .link-card {
        border-radius: 10px;
    }
    
    .device-info,
    .link-card {
        padding: 1rem;
    }
    
    .footer {
        padding: 0.5rem 0;
        margin-top: 1.5rem;
        border-top-left-radius: 10px;
        border-top-right-radius: 10px;
    }
    
    .footer-content {
        padding: 0 0.8rem;
    }
    
    .footer-text p {
        font-size: 0.9rem;
    }
    
    /* 小屏幕联系信息间距优化 */
    .contact-item {
        margin-bottom: 0.15rem;
        padding: 0.15rem;
    }
}

/* 超小屏幕设备适配 */
@media (max-width: 360px) {
    .container {
        margin: 0.3rem auto;
        border-radius: 8px;
        width: calc(100% - 0.6rem);
    }
    
    /* 超小屏幕背景图优化 */
    body {
        background-size: 100px 100px;
    }
    
    .profile-section,
    .content-section {
        padding: 0.6rem;
    }
    
    .name {
        font-size: 1.3rem;
        animation: typing 1.3s steps(20, end) 0.5s forwards, gradient-shift 1.8s ease-in-out infinite 1.8s;
        overflow: hidden;
        white-space: nowrap;
        width: 0;
    }
    
    /* 超小屏幕优化悬停效果 */
    .name.typing-complete:hover {
        transform: scale(1.01);
    }
    
    .avatar {
        width: 80px;
        height: 80px;
    }
    
    .toggle-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }
    
    .content-area h2 {
        font-size: 1.3rem;
    }
    
    /* 超小屏幕联系信息间距优化 */
    .contact-item {
        margin-bottom: 0.1rem;
        padding: 0.1rem;
    }
}

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .container {
        margin: 0.5rem auto;
        min-height: auto;
        width: calc(100% - 1rem);
    }
    
    /* 横屏模式背景图优化 */
    body {
        background-size: 120px 120px;
        background-attachment: scroll;
    }
    
    .profile-section {
        padding: 0.8rem;
    }
    
    .avatar {
        width: 80px;
        height: 80px;
    }
    
    .name {
        font-size: 1.2rem;
        margin-bottom: 0.3rem;
        animation: typing 1.2s steps(20, end) 0.5s forwards, gradient-shift 1.5s ease-in-out infinite 1.7s;
        overflow: hidden;
        white-space: nowrap;
        width: 0;
    }
    
    /* 横屏模式优化悬停效果 */
    .name.typing-complete:hover {
        transform: scale(1.01);
    }
    
    .bio {
        margin-bottom: 1rem;
        font-size: 0.85rem;
    }
    
    .contact-info {
        margin-bottom: 0.5rem;
    }
}
