/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background: linear-gradient(135deg, #f4e4c1 0%, #e6d3a3 50%, #d4c4a8 100%);
    min-height: 100vh;
    color: #2c3e50;
    overflow-x: hidden;
    position: relative;
}

/* 古籍纸张纹理效果 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(139, 69, 19, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(160, 82, 45, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(101, 67, 33, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* 背景动画 */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.floating-char {
    position: absolute;
    font-size: 2rem;
    color: rgba(139, 69, 19, 0.08);
    animation: float 20s infinite linear;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.floating-char:nth-child(1) { top: 10%; left: 10%; animation-delay: 0s; }
.floating-char:nth-child(2) { top: 20%; left: 80%; animation-delay: 3s; }
.floating-char:nth-child(3) { top: 60%; left: 15%; animation-delay: 6s; }
.floating-char:nth-child(4) { top: 40%; left: 85%; animation-delay: 9s; }
.floating-char:nth-child(5) { top: 80%; left: 50%; animation-delay: 12s; }
.floating-char:nth-child(6) { top: 30%; left: 60%; animation-delay: 15s; }

@keyframes float {
    0% { transform: translateY(0px) rotate(0deg); opacity: 0.1; }
    50% { transform: translateY(-20px) rotate(180deg); opacity: 0.3; }
    100% { transform: translateY(0px) rotate(360deg); opacity: 0.1; }
}

/* 主容器 */
.container {
    position: relative;
    z-index: 3;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInDown 1s ease-out;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 10px;
}

.logo-svg {
    position: relative;
    display: inline-block;
}

.logo-image {
    width: 80px;
    height: 80px;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
    transition: all 0.3s ease;
}

.logo-image:hover {
    transform: scale(1.1);
    filter: drop-shadow(3px 3px 6px rgba(0, 0, 0, 0.4));
}

.logo i {
    font-size: 3rem;
    color: #8b4513;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.logo h1 {
    font-size: 3rem;
    color: #8b4513;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2rem;
    color: #5d4e37;
    font-weight: 300;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

/* 搜索区域 */
.search-section {
    margin-bottom: 50px;
    animation: fadeInUp 1s ease-out 0.3s both;
}

.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto 30px;
}

.search-box {
    display: flex;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 25px;
    padding: 5px;
    box-shadow: 0 8px 25px rgba(139, 69, 19, 0.15), inset 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(139, 69, 19, 0.2);
    transition: all 0.3s ease;
}

.search-box:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

#searchInput {
    flex: 1;
    border: none;
    outline: none;
    padding: 20px 25px;
    font-size: 1.1rem;
    background: transparent;
    color: #333;
}

#searchInput::placeholder {
    color: #999;
}

.search-btn {
    background: linear-gradient(135deg, #8b4513, #a0522d);
    border: none;
    border-radius: 20px;
    padding: 15px 25px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(139, 69, 19, 0.3);
}

.search-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(139, 69, 19, 0.4);
}

/* 搜索建议 */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    display: none;
}

.suggestion-item {
    padding: 15px 25px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s ease;
}

.suggestion-item:hover {
    background: #f8f9fa;
}

.suggestion-item:last-child {
    border-bottom: none;
}

/* 热门标签 */
.popular-tags {
    text-align: center;
}

.tag-label {
    color: #5d4e37;
    font-size: 1rem;
    margin-right: 15px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.tag {
    background: rgba(139, 69, 19, 0.1);
    color: #8b4513;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    border: 1px solid rgba(139, 69, 19, 0.3);
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.1);
}

.tag:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* 结果区域 */
.results-section {
    margin-bottom: 50px;
}

.loading {
    text-align: center;
    padding: 50px;
    color: #8b4513;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(139, 69, 19, 0.3);
    border-top: 4px solid #8b4513;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.no-results {
    text-align: center;
    padding: 50px;
    color: #8b4513;
}

.no-results i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.7;
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

/* 结果卡片 */
.result-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 8px 25px rgba(139, 69, 19, 0.15), inset 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(139, 69, 19, 0.1);
    animation: slideInUp 0.6s ease-out;
    transition: all 0.3s ease;
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(139, 69, 19, 0.25);
}

.cy-title {
    font-size: 2.5rem;
    color: #8b4513;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.cy-pinyin {
    text-align: center;
    color: #a0522d;
    font-size: 1.1rem;
    margin-bottom: 20px;
    font-style: italic;
}

.cy-meaning {
    background: linear-gradient(135deg, #fdf6e3, #f4e4c1);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    border-left: 4px solid #8b4513;
    box-shadow: inset 0 1px 3px rgba(139, 69, 19, 0.1);
}

.cy-meaning h4 {
    color: #8b4513;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.cy-meaning p {
    color: #555;
    line-height: 1.6;
    font-size: 1.1rem;
}

.cy-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.detail-item {
    background: #fdf6e3;
    padding: 20px;
    border-radius: 15px;
    border-left: 4px solid #8b4513;
    box-shadow: inset 0 1px 3px rgba(139, 69, 19, 0.1);
}

.detail-item h5 {
    color: #8b4513;
    margin-bottom: 10px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-item p {
    color: #555;
    line-height: 1.6;
}

/* 功能特色 */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.feature-card {
    background: rgba(139, 69, 19, 0.1);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    color: #8b4513;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(139, 69, 19, 0.2);
    transition: all 0.3s ease;
    animation: fadeInUp 1s ease-out 0.6s both;
    box-shadow: 0 8px 25px rgba(139, 69, 19, 0.1);
}

.feature-card:hover {
    transform: translateY(-10px);
    background: rgba(139, 69, 19, 0.15);
    box-shadow: 0 12px 35px rgba(139, 69, 19, 0.2);
}

.feature-card i {
    font-size: 3rem;
    margin-bottom: 20px;
    color: #8b4513;
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.feature-card p {
    font-size: 1rem;
    line-height: 1.6;
    opacity: 0.9;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 30px;
    color: #5d4e37;
    font-size: 0.9rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

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

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

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

/* 额外的动态效果 */
.result-card {
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.result-card:hover::before {
    left: 100%;
}

/* 打字机效果 */
.typewriter {
    overflow: hidden;
    border-right: 2px solid #667eea;
    white-space: nowrap;
    animation: typing 2s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: #667eea }
}

/* 粒子背景效果 */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: particle-float 15s infinite linear;
}

@keyframes particle-float {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* 搜索框聚焦效果 */
.search-box.focused {
    transform: scale(1.02);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

/* 标签悬停效果增强 */
.tag {
    position: relative;
    overflow: hidden;
}

.tag::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.tag:hover::before {
    left: 100%;
}

/* 功能卡片悬停效果 */
.feature-card {
    position: relative;
    overflow: hidden;
}

.feature-card::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.feature-card:hover::after {
    width: 300px;
    height: 300px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .logo {
        flex-direction: column;
        gap: 15px;
    }
    
    .logo-image {
        width: 60px;
        height: 60px;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .logo i {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .search-box {
        flex-direction: column;
        border-radius: 15px;
    }
    
    .search-btn {
        border-radius: 15px;
        margin-top: 10px;
    }
    
    .cy-title {
        font-size: 2rem;
    }
    
    .cy-details {
        grid-template-columns: 1fr;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
    
    .tags {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .logo {
        flex-direction: column;
        gap: 10px;
    }
    
    .logo-image {
        width: 50px;
        height: 50px;
    }
    
    .logo h1 {
        font-size: 1.8rem;
    }
    
    .result-card {
        padding: 20px;
    }
    
    .cy-title {
        font-size: 1.8rem;
    }
}
