/* ========================================
   首页样式
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* 背景动画效果 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(34, 211, 238, 0.05) 0%, transparent 50%);
    z-index: -1;
    animation: bgAnimation 20s ease-in-out infinite;
}

@keyframes bgAnimation {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-20px, -20px) rotate(1deg); }
    50% { transform: translate(20px, -10px) rotate(-1deg); }
    75% { transform: translate(-10px, 20px) rotate(1deg); }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.header {
    text-align: center;
    margin-bottom: 60px;
    padding-top: 40px;
    animation: fadeInDown 0.8s ease-out;
}

.header h1 {
    font-size: 3.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    position: relative;
    display: inline-block;
}

.header h1::after {
    content: '.fun';
    position: absolute;
    right: -5px;
    top: 0;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 50%, 100% { opacity: 1; }
    25%, 75% { opacity: 0.3; }
}

.header p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-top: 10px;
}

.search-box {
    max-width: 600px;
    margin: 0 auto 50px;
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    gap: 12px;
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.search-box:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 4px 20px rgba(0, 0, 0, 0.2);
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    padding: 4px 8px;
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

.search-btn {
    background: var(--gradient-button);
    color: white;
    border: none;
    padding: 10px 28px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.search-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.search-btn:hover::before {
    width: 300px;
    height: 300px;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

.section {
    margin-bottom: 50px;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 30px;
    color: var(--text-secondary);
    padding-left: 20px;
    position: relative;
    display: inline-block;
}

.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 100%;
    background: var(--gradient-button);
    border-radius: 2px;
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
}

.link-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    padding: 30px 24px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

.link-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--gradient-primary);
    border-radius: 16px;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.link-card::after {
    content: '';
    position: absolute;
    inset: 1px;
    background: var(--bg-card);
    border-radius: 15px;
    z-index: -1;
}

.link-card:hover::before {
    opacity: 1;
}

.link-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-hover);
}

.link-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: var(--icon-bg);
    border-radius: 20px;
    transition: all 0.3s ease;
}

.link-card:hover .link-icon {
    transform: rotate(10deg) scale(1.1);
    background: var(--icon-bg-hover);
}

.link-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.link-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.link-new {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #ec4899, #f43f5e);
    color: white;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.footer {
    text-align: center;
    margin-top: 100px;
    padding: 40px 0 30px;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-secondary);
    animation: fadeIn 0.8s ease-out 0.6s both;
}

.footer a {
    color: var(--text-tertiary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #3b82f6;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2.5rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .search-box {
        padding: 16px;
        flex-direction: column;
    }
    
    .search-btn {
        width: 100%;
    }
    
    .links-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 16px;
    }
    
    .link-card {
        padding: 20px 16px;
    }
    
    .link-icon {
        font-size: 2.5rem;
        width: 60px;
        height: 60px;
    }
    
    .link-title {
        font-size: 1rem;
    }
    
    .link-desc {
        font-size: 0.8rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.link-card:nth-child(1) { animation-delay: 0.1s; }
.link-card:nth-child(2) { animation-delay: 0.15s; }
.link-card:nth-child(3) { animation-delay: 0.2s; }
.link-card:nth-child(4) { animation-delay: 0.25s; }
.link-card:nth-child(5) { animation-delay: 0.3s; }
.link-card:nth-child(6) { animation-delay: 0.35s; }
.link-card:nth-child(7) { animation-delay: 0.4s; }
.link-card:nth-child(8) { animation-delay: 0.45s; }
.link-card:nth-child(9) { animation-delay: 0.5s; }
.link-card:nth-child(10) { animation-delay: 0.55s; }

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}