@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

/* 性能优化：预加载关键资源 */
@media (min-width: 768px) {
    .hero::before,
    .article-card::before {
        content: '';
        will-change: transform, opacity;
    }
}

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --warm-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    --dark-gradient: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    
    --text-primary: #2c3e50;
    --text-secondary: #5a6c7d;
    --text-light: #8491a0;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-accent: #eef2f7;
    
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 8px 40px rgba(0, 0, 0, 0.12);
    --shadow-hard: 0 12px 60px rgba(0, 0, 0, 0.15);
    
    --border-radius: 16px;
    --border-radius-large: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Noto Serif SC', sans-serif;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-secondary);
    font-size: 16px;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

header {
    background: var(--primary-gradient);
    color: white;
    padding: 20px 0;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-medium);
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='4'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
    pointer-events: none;
}

.navbar {
    position: relative;
    z-index: 2;
}

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

.logo {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.logo h1 {
    font-family: 'Noto Serif SC', serif;
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.logo p {
    font-size: 0.95rem;
    opacity: 0.9;
    font-weight: 400;
    letter-spacing: 0.5px;
}

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

.nav-menu li {
    position: relative;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    padding: 8px 16px;
    border-radius: 8px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.nav-menu a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: var(--transition);
}

.nav-menu a:hover::before {
    left: 0;
}

.nav-menu a:hover {
    transform: translateY(-2px);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.hero {
    background: var(--primary-gradient);
    color: white;
    padding: 80px 0 120px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
}

.hero-content h1 {
    font-family: 'Noto Serif SC', serif;
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.hero-content p {
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    margin-bottom: 2.5rem;
    opacity: 0.95;
    line-height: 1.6;
    font-weight: 400;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    background: white;
    color: var(--text-primary);
    padding: 16px 32px;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: var(--transition);
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

.cta-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--accent-gradient);
    transition: var(--transition);
    z-index: -1;
}

.cta-button:hover::before {
    left: 0;
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
    color: white;
}

.articles-section {
    padding: 100px 0;
    background: var(--bg-primary);
    position: relative;
}

.articles-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.articles-section .container {
    position: relative;
    z-index: 2;
}

.articles-section h2 {
    text-align: center;
    font-family: 'Noto Serif SC', serif;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    margin-bottom: 4rem;
    color: var(--text-primary);
    position: relative;
}

.articles-section h2::after {
    content: '';
    position: absolute;
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--secondary-gradient);
    border-radius: 2px;
}

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

.article-card {
    background: white;
    border-radius: var(--border-radius-large);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: var(--transition);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--warm-gradient);
    opacity: 0;
    transition: var(--transition);
    z-index: -1;
}

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

.article-card:hover::before {
    opacity: 0.03;
}

.article-image {
    height: 220px;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.article-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
}

.placeholder-image {
    font-size: 4rem;
    opacity: 0.9;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.article-content {
    padding: 2rem;
}

.article-content h3 {
    margin-bottom: 1rem;
    font-family: 'Noto Serif SC', serif;
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
}

.article-content h3 a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
    background: linear-gradient(135deg, var(--text-primary), var(--text-primary)) no-repeat;
    background-size: 0% 2px;
    background-position: 0% 100%;
}

.article-content h3 a:hover {
    background: var(--secondary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 100% 2px;
}

.article-excerpt {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.7;
    font-size: 0.95rem;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-light);
}

.date {
    font-weight: 500;
}

.category {
    background: var(--secondary-gradient);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

footer {
    background: var(--dark-gradient);
    color: white;
    padding: 60px 0 30px;
    margin-top: 100px;
    position: relative;
    overflow: hidden;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M20 20c0-5.5-4.5-10-10-10s-10 4.5-10 10 4.5 10 10 10 10-4.5 10-10zm10 0c0-5.5-4.5-10-10-10s-10 4.5-10 10 4.5 10 10 10 10-4.5 10-10z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
    position: relative;
    z-index: 2;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 1.5rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
}

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

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

.footer-section a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
}

.footer-section a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-gradient);
    transition: var(--transition);
}

.footer-section a:hover {
    color: white;
}

.footer-section a:hover::after {
    width: 100%;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    position: relative;
    z-index: 2;
}

.article-page {
    background: white;
    max-width: 900px;
    margin: 2rem auto;
    padding: 3rem;
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-medium);
    position: relative;
    overflow: hidden;
}

.article-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--secondary-gradient);
}

.article-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--bg-accent);
    position: relative;
}

.article-title {
    font-family: 'Noto Serif SC', serif;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.article-meta-full {
    display: flex;
    justify-content: center;
    gap: 2rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.article-content-full {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-primary);
    font-family: 'Noto Serif SC', serif;
}

.article-content-full h2 {
    font-size: 1.9rem;
    margin: 3rem 0 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
    position: relative;
    padding-left: 1rem;
}

.article-content-full h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--secondary-gradient);
    border-radius: 2px;
}

.article-content-full h3 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.article-content-full h4 {
    font-size: 1.3rem;
    margin: 1.5rem 0 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.article-content-full p {
    margin-bottom: 1.8rem;
    text-align: justify;
}

.article-content-full strong {
    color: var(--text-primary);
    font-weight: 600;
}

.article-content-full em {
    color: var(--text-secondary);
    font-style: italic;
    padding: 1rem;
    background: var(--bg-accent);
    border-radius: var(--border-radius);
    display: block;
    margin: 2rem 0;
    border-left: 4px solid var(--secondary-gradient);
}

.article-content-full ul,
.article-content-full ol {
    margin: 1.5rem 0 2rem 2rem;
}

.article-content-full li {
    margin-bottom: 0.8rem;
    line-height: 1.7;
}

.article-content-full table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.article-content-full th,
.article-content-full td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--bg-accent);
}

.article-content-full th {
    background: var(--bg-accent);
    font-weight: 600;
    color: var(--text-primary);
}

.back-link {
    display: inline-flex;
    align-items: center;
    margin: 2rem 0;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--bg-accent);
}

.back-link:hover {
    color: var(--text-primary);
    transform: translateX(-4px);
    background: var(--bg-secondary);
}

.stories-section,
.help-section {
    padding: 100px 0;
    background: var(--bg-primary);
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title {
    font-family: 'Noto Serif SC', serif;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    margin-bottom: 1rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

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

.story-card {
    background: white;
    padding: 2.5rem;
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-soft);
    transition: var(--transition);
    position: relative;
    border-left: 5px solid transparent;
}

.story-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
    border-left-color: var(--secondary-gradient);
}

.story-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.story-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    margin-right: 1rem;
    font-weight: 600;
}

.story-info h4 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.story-meta {
    font-size: 0.9rem;
    color: var(--text-light);
}

.story-content {
    color: var(--text-secondary);
    line-height: 1.7;
    font-style: italic;
}

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

.help-card {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-soft);
    transition: var(--transition);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.help-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-gradient);
}

.help-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
}

.help-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.help-card h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.help-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.help-link {
    display: inline-flex;
    align-items: center;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--bg-accent);
}

.help-link:hover {
    background: var(--secondary-gradient);
    color: white;
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1.5rem;
        padding: 0 16px;
    }
    
    .nav-menu {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .hero {
        padding: 60px 0 80px;
    }
    
    .hero-content {
        padding: 0 16px;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .article-card {
        margin: 0 16px;
    }
    
    .article-page {
        margin: 1rem 16px;
        padding: 2rem 1.5rem;
    }
    
    .article-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .stories-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .story-card {
        margin: 0 16px;
    }
    
    .help-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .help-card {
        margin: 0 16px;
    }
    
    .container {
        padding: 0 16px;
    }
}

@media (max-width: 480px) {
    .article-content-full h2 {
        font-size: 1.5rem;
    }
    
    .article-content-full h3 {
        font-size: 1.3rem;
    }
    
    .story-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
}

/* Rain Effect Optimizations */
#rain-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

/* 在移动设备上减少雨滴透明度以提高性能 */
@media (max-width: 768px) {
    #rain-canvas {
        opacity: 0.4;
    }
}

/* 音乐播放器样式优化 */
#music-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#music-controls:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* 确保控件在所有元素之上 */
#music-controls * {
    position: relative;
    z-index: 1001;
}

/* 性能优化：减少不必要的重绘 */
.article-card,
.story-card,
.help-card {
    transform: translateZ(0); /* 启用硬件加速 */
    backface-visibility: hidden;
}

/* Scroll animations */
@media (prefers-reduced-motion: no-preference) {
    .article-card,
    .story-card,
    .help-card {
        opacity: 0;
        transform: translateY(30px) translateZ(0);
        animation: fadeInUp 0.6s ease forwards;
    }
    
    .article-card:nth-child(1) { animation-delay: 0.1s; }
    .article-card:nth-child(2) { animation-delay: 0.2s; }
    .article-card:nth-child(3) { animation-delay: 0.3s; }
    .article-card:nth-child(4) { animation-delay: 0.4s; }
    .article-card:nth-child(5) { animation-delay: 0.5s; }
    .article-card:nth-child(6) { animation-delay: 0.6s; }
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0) translateZ(0);
    }
}

/* 雨滴和音乐控件的媒体查询优化 */
@media (max-width: 768px) {
    #music-controls {
        top: 10px;
        right: 10px;
        padding: 8px;
        border-radius: 8px;
    }
    
    /* 在小屏幕上简化雨滴效果 */
    #rain-canvas {
        opacity: 0.3;
    }
}

@media (prefers-reduced-motion: reduce) {
    /* 尊重用户的动画偏好设置 */
    #rain-canvas {
        display: none;
    }
    
    .article-card,
    .story-card,
    .help-card {
        opacity: 1;
        transform: none;
        animation: none;
    }
}