/* ==================== 基础变量 ==================== */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #0f0f23;
    --bg-card: #141428;
    --border-color: rgba(99, 102, 241, 0.15);
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    --glow-color: rgba(99, 102, 241, 0.3);
    --text-primary: #f0f0ff;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b80;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --hover-bg: rgba(99, 102, 241, 0.1);
}

/* ==================== 白天模式变量 ==================== */
body.light-mode {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --border-color: rgba(99, 102, 241, 0.2);
    --accent-primary: #4f46e5;
    --accent-secondary: #7c3aed;
    --accent-gradient: linear-gradient(135deg, #4f46e5, #7c3aed);
    --glow-color: rgba(99, 102, 241, 0.2);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --success: #059669;
    --warning: #d97706;
    --error: #dc2626;
    --hover-bg: rgba(99, 102, 241, 0.08);
}

body.light-mode .navbar {
    background: rgba(255, 255, 255, 0.95);
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .nav-link {
    color: var(--text-secondary);
}

body.light-mode .nav-link:hover,
body.light-mode .nav-link.active {
    color: var(--accent-primary);
}

body.light-mode .footer {
    background: var(--bg-secondary);
    border-top-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .social-link {
    background: var(--bg-card);
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .social-link:hover {
    border-color: var(--accent-primary);
    background: var(--hover-bg);
}

body.light-mode .copyright {
    color: var(--text-muted);
}

body.light-mode .particle-toggle {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .toggle-text {
    color: var(--text-primary);
}

body.light-mode .theme-toggle {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .theme-toggle:hover {
    border-color: var(--accent-primary);
    background: var(--accent-primary);
}

body.light-mode .theme-toggle i {
    color: var(--text-primary);
}

body.light-mode .theme-toggle:hover i {
    color: white;
}

body.light-mode .theme-toggle .theme-text {
    color: #1e293b;
}

body.light-mode .theme-toggle:hover .theme-text {
    color: white;
}

body.light-mode .mobile-nav {
    background: rgba(255, 255, 255, 0.98);
}

body.light-mode .mobile-nav .nav-link {
    color: var(--text-primary);
}

body.light-mode .mobile-menu-btn span {
    background: var(--text-primary);
}

/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ==================== 背景动画 ==================== */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-primary), transparent);
    top: -100px;
    right: -100px;
    animation: orbFloat1 20s ease-in-out infinite;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--accent-secondary), transparent);
    bottom: -50px;
    left: -50px;
    animation: orbFloat2 25s ease-in-out infinite;
}

.orb-3 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, #ec4899, transparent);
    top: 50%;
    left: 50%;
    animation: orbFloat3 30s ease-in-out infinite;
}

@keyframes orbFloat1 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-50px, 50px); }
}

@keyframes orbFloat2 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(50px, -30px); }
}

@keyframes orbFloat3 {
    0%, 100% { transform: translate(-50%, -50%); }
    50% { transform: translate(-40%, -60%); }
}

/* ==================== 导航栏 ==================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 16px 0;
    background: rgba(10, 10, 26, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 700;
}

.logo-bracket {
    color: var(--accent-primary);
}

.logo-text {
    color: var(--text-primary);
    margin: 0 2px;
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-link {
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-gradient);
    border-radius: 1px;
}

.cta-btn {
    padding: 10px 20px;
    background: var(--accent-gradient);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--glow-color);
}

/* ==================== 通用按钮 ==================== */
.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--accent-gradient);
    border: none;
    color: white;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px var(--glow-color);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
}

.btn-full {
    width: 100%;
    justify-content: center;
}

/* ==================== 代码窗口 ==================== */
.code-window {
    width: 100%;
    max-width: 500px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    animation: codeFloat 6s ease-in-out infinite;
}

@keyframes codeFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.window-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-color);
}

.window-dots {
    display: flex;
    gap: 6px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27ca40; }

.window-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.code-content {
    padding: 20px;
    overflow-x: auto;
}

.code-content pre {
    margin: 0;
}

.code-content code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.8;
}

.keyword { color: #c792ea; }
.property { color: #82aaff; }
.variable { color: #f78c6c; }
.string { color: #c3e88d; }
.comment { color: #546e7a; font-style: italic; }

/* ==================== 页面导航 ==================== */
.page-nav {
    display: flex;
    justify-content: center;
    padding: 30px 0;
}

.page-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.page-nav-btn:hover {
    border-color: var(--accent-primary);
    background: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--glow-color);
}

.page-nav-btn i {
    transition: transform 0.3s ease;
}

.page-nav-btn:hover i {
    transform: translateX(4px);
}

/* ==================== 页脚 ==================== */
.footer {
    padding: 40px 0;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: none;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.footer-logo {
    display: flex;
    align-items: center;
    font-size: 1rem;
    font-weight: 700;
}

.social-links {
    display: flex;
    gap: 16px;
}

.social-link {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.social-link:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-3px);
}

.copyright {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ==================== 鼠标追踪画布 ==================== */
#mouseCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* ==================== 粒子特效开关 ==================== */
.particle-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    background: rgba(15, 15, 35, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.particle-toggle:hover {
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 4px 25px rgba(99, 102, 241, 0.2);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle-text {
    color: #e0e0f0;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.toggle-label input {
    display: none;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #6366f1;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.toggle-label input:checked + .toggle-switch {
    background: rgba(99, 102, 241, 0.4);
}

.toggle-label input:checked + .toggle-switch::after {
    left: 23px;
    background: #818cf8;
    box-shadow: 0 2px 12px rgba(129, 140, 248, 0.6);
}

/* ==================== 主题切换按钮 ==================== */
.theme-toggle {
    position: fixed;
    bottom: 80px;
    right: 24px;
    z-index: 10000;
    height: 48px;
    padding: 0 16px;
    border-radius: 12px;
    background: rgba(15, 15, 35, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(99, 102, 241, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.theme-toggle:hover {
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 4px 25px rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
}

.theme-toggle i {
    font-size: 20px;
    color: #e0e0f0;
    transition: all 0.3s ease;
}

.theme-toggle:hover i {
    color: #818cf8;
}

.theme-toggle .theme-text {
    color: #e0e0f0;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.theme-toggle:hover .theme-text {
    color: #818cf8;
}

.theme-toggle .sun-icon {
    display: none;
}

.theme-toggle .moon-icon {
    display: block;
}

body.light-mode .theme-toggle .sun-icon {
    display: block;
}

body.light-mode .theme-toggle .moon-icon {
    display: none;
}

body.light-mode .theme-toggle:hover {
    border-color: var(--accent-primary);
    background: var(--accent-primary);
}

body.light-mode .theme-toggle:hover i,
body.light-mode .theme-toggle:hover .theme-text {
    color: white;
}

/* ==================== 通用页面结构 ==================== */
.page-section {
    padding: 120px 0 80px;
    min-height: 100vh;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-tag {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 50px;
    font-size: 0.85rem;
    color: var(--accent-primary);
    margin-bottom: 16px;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.section-desc {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ==================== 响应式 ==================== */

/* 汉堡菜单按钮 */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-btn span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* 移动端导航菜单 */
.mobile-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(10, 10, 26, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-nav.active {
    display: flex;
    opacity: 1;
}

.mobile-nav .nav-link {
    font-size: 1.25rem;
    padding: 12px 24px;
    min-width: 140px;
    text-align: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.mobile-nav .nav-link:active {
    background: rgba(99, 102, 241, 0.15);
    transform: scale(0.98);
}

/* 桌面端隐藏CTA按钮 */
.nav-container .cta-btn {
    display: none;
}

@media (max-width: 1024px) {
    .nav-links {
        display: none;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .section-title {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 12px 0;
    }
    
    .nav-container {
        padding: 0 16px;
    }
    
    .logo {
        font-size: 1.1rem;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
    
    .section-desc {
        font-size: 1rem;
    }
    
    .code-window {
        max-width: 100%;
    }
    
    .hero-stats {
        gap: 30px;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .page-section {
        padding: 80px 0 40px;
    }
    
    .page-nav-btn {
        padding: 12px 24px;
        font-size: 0.9rem;
    }
    
    /* 优化触摸目标大小 */
    .btn-primary, .btn-secondary {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* 粒子开关和主题按钮位置调整 */
    .particle-toggle {
        bottom: 16px;
        right: 16px;
        padding: 10px 12px;
    }
    
    .theme-toggle {
        bottom: 70px;
        right: 16px;
        height: 44px;
        padding: 0 12px;
    }
    
    .toggle-text, .theme-text {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .btn-primary, .btn-secondary {
        padding: 12px 20px;
        font-size: 0.9rem;
        min-height: 44px;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 16px;
    }
    
    .window-header {
        padding: 12px 16px;
    }
    
    .code-content {
        padding: 16px;
    }
    
    .code-content code {
        font-size: 0.7rem;
    }
    
    /* 移动端进一步优化 */
    .mobile-nav .nav-link {
        font-size: 1.1rem;
        padding: 10px 20px;
    }
    
    /* 粒子开关更紧凑 */
    .particle-toggle {
        bottom: 12px;
        right: 12px;
        padding: 8px 10px;
    }
    
    .toggle-text {
        display: none;
    }
    
    .theme-toggle {
        bottom: 60px;
        right: 12px;
        height: 40px;
        padding: 0 10px;
    }
    
    .theme-text {
        display: none;
    }
    
    .theme-toggle i {
        font-size: 18px;
    }
}

/* 横屏手机优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .mobile-nav {
        gap: 12px;
    }
    
    .mobile-nav .nav-link {
        font-size: 1rem;
        padding: 8px 16px;
    }
    
    .navbar {
        padding: 8px 0;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .btn-primary:hover,
    .btn-secondary:hover {
        transform: none;
        box-shadow: none;
    }
    
    .btn-primary:active,
    .btn-secondary:active {
        transform: scale(0.97);
        opacity: 0.9;
    }
    
    /* 触摸设备禁用hover效果 */
    .code-window:hover {
        transform: none;
    }
}

/* iOS Safari 安全区域适配 */
@supports (padding: env(safe-area-inset-bottom)) {
    .navbar {
        padding-top: max(16px, env(safe-area-inset-top));
    }
    
    .mobile-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .particle-toggle {
        bottom: max(16px, env(safe-area-inset-bottom));
    }
    
    .theme-toggle {
        bottom: max(70px, calc(60px + env(safe-area-inset-bottom)));
    }
}
