:root {
    --bg-primary: #f0f4ff;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --accent-1: #6366f1;
    --accent-2: #8b5cf6;
    --accent-3: #3b82f6;
    --gradient-1: linear-gradient(135deg, #6366f1, #8b5cf6);
    --gradient-2: linear-gradient(135deg, #3b82f6, #6366f1);
    --gradient-bg: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 50%, #f5f3ff 100%);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--gradient-bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.hero {
    position: relative;
    padding: 60px 0 40px;
    text-align: center;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(99,102,241,0.08) 0%, transparent 50%),
                radial-gradient(circle at 70% 50%, rgba(139,92,246,0.08) 0%, transparent 50%);
    animation: bgFloat 20s ease-in-out infinite;
    pointer-events: none;
}

@keyframes bgFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(2%, -2%) rotate(1deg); }
    66% { transform: translate(-1%, 1%) rotate(-1deg); }
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(99,102,241,0.1);
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: 100px;
    font-size: 13px;
    color: var(--accent-1);
    font-weight: 500;
    margin-bottom: 24px;
    animation: fadeInDown 0.6s ease-out;
}

.hero-badge-dot {
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 16px;
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

.hero-title .gradient-text {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 32px;
    line-height: 1.8;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-top: 40px;
    animation: fadeInUp 0.6s ease-out 0.3s both;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-1);
    display: block;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.section {
    position: relative;
    padding: 20px 0 60px;
}

.section-header {
    text-align: center;
    margin-bottom: 48px;
    animation: fadeInUp 0.6s ease-out;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    padding: 8px 0;
}

.project-card {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.04);
    transition: var(--transition);
    cursor: pointer;
    animation: fadeInUp 0.5s ease-out both;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--card-color, var(--gradient-1));
    opacity: 0;
    transition: var(--transition);
}

.project-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.project-card:hover::before {
    opacity: 1;
}

.project-card:hover .project-arrow {
    transform: translateX(4px) rotate(-45deg);
    opacity: 1;
}

.project-card:nth-child(1) { animation-delay: 0.05s; }
.project-card:nth-child(2) { animation-delay: 0.1s; }
.project-card:nth-child(3) { animation-delay: 0.15s; }
.project-card:nth-child(4) { animation-delay: 0.2s; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card-icon-wrapper {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 16px;
    background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(139,92,246,0.1));
    transition: var(--transition);
}

.project-card:hover .card-icon-wrapper {
    transform: scale(1.05) rotate(-5deg);
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-1);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.card-link:hover {
    gap: 10px;
    color: var(--accent-2);
}

.project-arrow {
    font-size: 1rem;
    transition: var(--transition);
    opacity: 0.6;
}

/* Search */
.search-wrapper {
    max-width: 480px;
    margin: -20px auto 40px;
    position: relative;
    z-index: 2;
}

.search-box {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    border: 2px solid rgba(0,0,0,0.06);
    border-radius: 100px;
    font-size: 0.95rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
}

.search-input:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 4px rgba(99,102,241,0.1);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
}

.search-clear {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    display: none;
    border-radius: 50%;
    transition: var(--transition);
}

.search-clear:hover {
    color: var(--text-primary);
    background: rgba(0,0,0,0.05);
}

.search-clear.visible {
    display: block;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    animation: fadeInUp 0.5s ease-out;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-text {
    font-size: 1.1rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 32px 24px;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.footer a {
    color: var(--accent-1);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    height: 200px;
    border-radius: var(--radius-md);
}

/* Loading spinner */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(99,102,241,0.1);
    border-top-color: var(--accent-1);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast notification */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    animation: slideIn 0.3s ease-out;
    max-width: 360px;
}

.toast.error {
    border-left: 3px solid #ef4444;
}

.toast.success {
    border-left: 3px solid #22c55e;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Particle background (canvas) */
#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .hero {
        padding: 40px 0 24px;
    }

    .hero-stats {
        gap: 24px;
        flex-wrap: wrap;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .project-card {
        padding: 20px;
    }

    .search-wrapper {
        margin: -12px auto 24px;
        padding: 0 4px;
    }

    .container {
        padding: 0 16px;
    }

    .stat-number {
        font-size: 1.5rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}