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

body, html {
    overflow-x: hidden;
    margin: 0;
}

/* 游戏弹窗自适应优化加强 */
#snake-modal {
    max-width: 100vw;
    overflow-x: hidden;
}
.game-modal-content {
    max-width: 480px;
    width: 95vw;
    min-width: 0;
    box-sizing: border-box;
    padding: 0;
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(99,102,241,0.18), 0 2px 8px rgba(0,0,0,0.08);
    background: #f8fafc;
    position: relative;
    margin: 0 auto;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    overflow-y: auto;
}
.snake-modal-inner {
    padding: 2.2rem 1.2rem 2.5rem 1.2rem;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 70vh;
}
.snake-game-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    padding-bottom: 2.5rem;
}
#snake-canvas {
    width: 100% !important;
    max-width: 400px;
    height: auto;
    aspect-ratio: 1 / 1;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(99,102,241,0.10), 0 1.5px 6px rgba(0,0,0,0.04);
    border: 2px solid #6366f1;
    outline: none;
    margin-bottom: 1rem;
    display: block;
    box-sizing: border-box;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 600px) {
    .container {
        width: 100vw;
        max-width: 100vw;
        padding: 0 4vw;
        box-sizing: border-box;
    }
    .projects-grid, .blog-grid, .news-list, .games-scroll {
        max-width: 100vw;
    }
    .project-card, .blog-card, .news-card, .game-card {
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* 导航栏 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-logo h2 {
    color: #6366f1;
    font-weight: 700;
    font-size: 1.5rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: #6366f1;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: #6366f1;
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: #333;
    margin: 3px 0;
    transition: 0.3s;
}

/* 英雄区域 */
.hero {
    padding: 120px 0 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.hero-description {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    opacity: 0.8;
    line-height: 1.7;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #6366f1;
    color: white;
}

.btn-primary:hover {
    background: #5855eb;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* 代码窗口 */
.code-window {
    background: #1e1e1e;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.window-header {
    background: #2d2d2d;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.window-buttons {
    display: flex;
    gap: 6px;
}

.btn-red, .btn-yellow, .btn-green {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.btn-red { background: #ff5f56; }
.btn-yellow { background: #ffbd2e; }
.btn-green { background: #27ca3f; }

.window-title {
    color: #999;
    font-size: 0.9rem;
    margin-left: 8px;
}

.window-content {
    padding: 20px;
}

.window-content pre {
    margin: 0;
    color: #d4d4d4;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* 项目区域 */
.projects {
    padding: 80px 0;
    background: white;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    color: #333;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.project-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

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

.project-card.featured {
    border: 2px solid #6366f1;
    position: relative;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.project-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.project-badge {
    background: #6366f1;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.project-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
}

.project-description {
    color: #666;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tech-tag {
    background: #f3f4f6;
    color: #374151;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.project-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.project-link {
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.3s ease;
}

.project-link:hover {
    color: #5855eb;
}

/* 关于区域 */
.about {
    padding: 80px 0;
    background: #f8fafc;
}

.about-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 4rem;
    align-items: center;
}

.about-description {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 2rem;
    line-height: 1.7;
}

.skills h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: #333;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.skill-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.skill-item i {
    font-size: 1.5rem;
    color: #6366f1;
}

.about-stats {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.stat-item {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #6366f1;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #666;
    font-weight: 500;
}

/* 博客区域 */
.blog {
    padding: 80px 0;
    background: white;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.blog-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

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

.blog-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.blog-content {
    padding: 1.5rem;
}

.blog-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.blog-date, .blog-category {
    font-size: 0.9rem;
    color: #666;
}

.blog-category {
    color: #6366f1;
    font-weight: 500;
}

.blog-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
}

.blog-excerpt {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.blog-link {
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.blog-link:hover {
    color: #5855eb;
}

/* 页脚 */
.footer {
    background: #1f2937;
    color: white;
    padding: 60px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3, .footer-section h4 {
    margin-bottom: 1rem;
    color: #f9fafb;
}

.footer-section p {
    color: #d1d5db;
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: #d1d5db;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: #6366f1;
}

.footer-bottom {
    border-top: 1px solid #374151;
    padding-top: 2rem;
    text-align: center;
    color: #9ca3af;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 1rem;
}

.close:hover {
    color: #333;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: white;
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        padding: 2rem 0;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .blog-grid {
        grid-template-columns: 1fr;
    }
    
    .hero-buttons {
        justify-content: center;
    }
    
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .project-card {
        padding: 1.5rem;
    }
    
    .skills-grid {
        grid-template-columns: 1fr;
    }
} 

/* 新闻区样式 */
.news {
    padding: 60px 0 40px;
    background: linear-gradient(90deg, #f8fafc 60%, #e0e7ff 100%);
}

.news-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.news-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(99,102,241,0.08), 0 1.5px 6px rgba(0,0,0,0.04);
    padding: 1.5rem 1.25rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 5px solid #6366f1;
    position: relative;
    min-height: 180px;
}

.news-card:hover {
    transform: translateY(-6px) scale(1.03);
    box-shadow: 0 8px 32px rgba(99,102,241,0.18), 0 2px 8px rgba(0,0,0,0.08);
    border-left: 5px solid #4f46e5;
}

.news-header {
    margin-bottom: 0.5rem;
}

.news-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #3730a3;
    text-decoration: none;
    transition: color 0.2s;
    word-break: break-all;
}

.news-title:hover {
    color: #6366f1;
    text-decoration: underline;
}

.news-desc {
    color: #444;
    font-size: 0.98rem;
    margin-bottom: 1.1rem;
    flex: 1;
    line-height: 1.6;
}

.news-meta {
    display: flex;
    gap: 1.2rem;
    font-size: 0.97rem;
    color: #6366f1;
    align-items: center;
}

.news-lang i, .news-stars i {
    margin-right: 4px;
    color: #6366f1;
}

@media (max-width: 600px) {
    .news-list {
        grid-template-columns: 1fr;
    }
    .news-card {
        padding: 1.1rem 0.8rem 1rem 0.8rem;
    }
} 

/* 贪吃蛇小游戏区块样式 */
.snake-game-section {
    padding: 60px 0 30px;
    background: linear-gradient(90deg, #e0e7ff 0%, #f8fafc 100%);
    border-top: 1px solid #e5e7eb;
}
.snake-game-tip {
    color: #6366f1;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    text-align: center;
}
.snake-game-tip #snake-best {
    color: #10b981;
    font-weight: 700;
}
.snake-game-actions {
    display: flex;
    justify-content: center;
    gap: 1.2rem;
    margin-bottom: 0.5rem;
}
.snake-game-actions .btn {
    min-width: 90px;
    font-size: 1rem;
    padding: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
@media (max-width: 600px) {
    .snake-game-tip {
        font-size: 1rem;
        padding: 0 0.2rem;
    }
    .snake-game-actions .btn {
        min-width: 80px;
        font-size: 0.95rem;
        padding: 8px 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
} 

/* 悬浮虚拟方向按钮 */
.snake-fab-controls {
    position: fixed;
    right: 2vw;
    bottom: 3vw;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    pointer-events: none;
}
.snake-fab-controls .snake-btn {
    pointer-events: auto;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #6366f1;
    color: #fff;
    font-size: 1.7rem;
    box-shadow: 0 2px 10px rgba(99,102,241,0.18);
    margin: 0 0.2rem;
    transition: background 0.2s, transform 0.1s;
    outline: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}
.snake-fab-controls .snake-btn:active {
    background: #4f46e5;
    transform: scale(0.95);
}
.snake-fab-controls > div {
    display: flex;
    justify-content: center;
    gap: 1.2rem;
}
@media (max-width: 600px) {
    .snake-fab-controls {
        right: 2vw;
        bottom: 2vw;
    }
    .snake-fab-controls .snake-btn {
        width: 48px;
        height: 48px;
        font-size: 1.3rem;
    }
} 

/* 小游戏乐园区块 */
.games {
    padding: 60px 0 40px;
    background: #f8fafc;
}
.games-scroll {
    display: flex;
    overflow-x: auto;
    gap: 2rem;
    padding-bottom: 1rem;
    scroll-snap-type: x mandatory;
}
.game-card {
    min-width: 320px;
    max-width: 340px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 4px 24px rgba(99,102,241,0.10), 0 1.5px 6px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1.2rem 1.2rem 1.2rem;
    scroll-snap-align: start;
    transition: transform 0.18s, box-shadow 0.18s;
    position: relative;
}
.game-card:hover {
    transform: translateY(-6px) scale(1.03);
    box-shadow: 0 8px 32px rgba(99,102,241,0.18), 0 2px 8px rgba(0,0,0,0.08);
}
.game-cover {
    width: 120px;
    height: 120px;
    border-radius: 16px;
    margin-bottom: 1.2rem;
    box-shadow: 0 2px 8px rgba(99,102,241,0.10);
    object-fit: cover;
}
.game-info h3 {
    font-size: 1.25rem;
    color: #3730a3;
    margin-bottom: 0.5rem;
    font-weight: 700;
}
.game-info p {
    color: #666;
    font-size: 1rem;
    margin-bottom: 1.2rem;
}
.game-info .btn {
    width: 100%;
}

/* 贪吃蛇游戏模态框 */
.game-modal-content {
    max-width: 480px;
    width: 95vw;
    padding: 0;
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(99,102,241,0.18), 0 2px 8px rgba(0,0,0,0.08);
    background: #f8fafc;
    position: relative;
    margin: 0 auto;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: visible;
}
.snake-modal-inner {
    padding: 2.2rem 1.2rem 1.2rem 1.2rem;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}
#snake-modal .close {
    position: absolute;
    right: 1.2rem;
    top: 1.2rem;
    font-size: 2rem;
    color: #6366f1;
    cursor: pointer;
    z-index: 10;
}
@media (max-width: 600px) {
    .games-scroll {
        gap: 1rem;
        padding-bottom: 0.5rem;
    }
    .game-card {
        min-width: 92vw;
        max-width: 98vw;
        padding: 1.2rem 0.5rem 1rem 0.5rem;
    }
    .game-cover {
        width: 80px;
        height: 80px;
        border-radius: 10px;
    }
    .game-modal-content {
        max-width: 99vw;
        width: 99vw;
        border-radius: 10px;
        min-height: 60vw;
        max-height: 98vh;
        margin: 0 auto;
    }
    .snake-modal-inner {
        padding: 1.2rem 0.2rem 0.5rem 0.2rem;
        width: 100%;
    }
    #snake-canvas {
        width: 90vw !important;
        height: 90vw !important;
        max-width: 99vw;
        max-height: 99vw;
    }
    .snake-game-tip {
        font-size: 1rem;
        padding: 0 0.2rem;
    }
    .snake-game-actions .btn {
        min-width: 80px;
        font-size: 0.95rem;
        padding: 8px 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
} 

.btn, .snake-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    vertical-align: middle;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.2;
    box-sizing: border-box;
}

.snake-game-actions .btn {
    min-width: 90px;
    font-size: 1rem;
    padding: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 600px) {
    .snake-game-actions .btn {
        min-width: 80px;
        font-size: 0.95rem;
        padding: 8px 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .snake-btn {
        font-size: 1.3rem;
    }
} 