/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4CAF50;
    --secondary-color: #2196F3;
    --accent-color: #E91E63;
    --dark-color: #2c3e50;
    --light-color: #f8f9fa;
    --text-color: #333;
    --text-light: #666;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-color);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
header {
    background-color: var(--dark-color);
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo h1 {
    font-size: 1.8rem;
    margin-bottom: 0.2rem;
}

.logo h1 a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}

.logo h1 a:hover {
    color: var(--primary-color);
}

.logo .subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
}

nav ul {
    display: flex;
    list-style: none;
    margin-top: 1rem;
    gap: 1.5rem;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

nav a:hover {
    color: var(--primary-color);
}

/* 英雄区域（首页） */
.hero {
    background: linear-gradient(135deg, var(--primary-color), #2E7D32);
    color: white;
    padding: 4rem 0;
    text-align: center;
    margin-bottom: 3rem;
    border-radius: 0 0 var(--radius) var(--radius);
}

.hero h1 {
    font-size: 2.8rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero-subtitle {
    font-size: 1.2rem;
    margin-bottom: 2.5rem;
    opacity: 0.9;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.search-form {
    max-width: 600px;
    margin: 0 auto 2.5rem;
}

.input-group {
    display: flex;
    background: white;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.input-group input {
    flex: 1;
    padding: 18px 25px;
    border: none;
    font-size: 1.1rem;
    outline: none;
    color: var(--text-color);
}

.search-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0 35px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-btn:hover {
    background-color: #C2185B;
}

.quick-search {
    margin-top: 2rem;
}

.quick-search p {
    margin-bottom: 1.2rem;
    font-size: 1.1rem;
}

.hanzi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.hanzi-card {
    display: block;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius);
    padding: 1.5rem 0.5rem;
    text-align: center;
    text-decoration: none;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hanzi-card:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.hanzi-char {
    font-size: 2.2rem;
    color: white;
    font-weight: 500;
}

/* 功能区域 */
.features {
    padding: 3rem 0;
    text-align: center;
}

.features h2 {
    font-size: 2.2rem;
    margin-bottom: 3rem;
    color: var(--dark-color);
    position: relative;
}

.features h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--primary-color);
    margin: 0.8rem auto;
    border-radius: 2px;
}

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

.feature-card {
    background-color: white;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    text-align: center;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.feature-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-color), #66BB6A);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.feature-icon i {
    font-size: 1.8rem;
    color: white;
}

.feature-card h3 {
    margin-bottom: 1rem;
    color: var(--dark-color);
    font-size: 1.3rem;
}

.feature-card p {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* 统计区域 */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    padding: 3rem 0;
    background: white;
    border-radius: var(--radius);
    margin: 3rem 0;
    box-shadow: var(--shadow);
}

.stat-item {
    text-align: center;
    padding: 1rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-light);
    font-size: 1rem;
}

/* 结果页面样式 */
.result-search {
    background: none;
    padding: 1.5rem 0;
}

.result-search .input-group {
    max-width: 500px;
    margin: 0 auto;
}

/* 汉字头部信息 */
.hanzi-header {
    background-color: white;
    padding: 2.5rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}

.hanzi-display {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.big-hanzi {
    font-size: 6rem;
    color: var(--dark-color);
    font-weight: 700;
    min-width: 120px;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.hanzi-meta {
    flex: 1;
}

.pinyin-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.pinyin-item {
    background: var(--accent-color);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 1.2rem;
    font-weight: 500;
}

.hanzi-stats {
    display: flex;
    gap: 1.5rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-light);
}

.stat-item i {
    color: var(--secondary-color);
}

/* 控制按钮 */
.hanzi-controls {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    width: 100%;
    justify-content: center;
}

.control-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.voice-btn {
    background-color: var(--primary-color);
    color: white;
}

.voice-btn:hover {
    background-color: #388E3C;
    transform: translateY(-2px);
}

.random-btn {
    background-color: var(--secondary-color);
    color: white;
}

.random-btn:hover {
    background-color: #1976D2;
    transform: translateY(-2px);
}

.share-btn {
    background-color: #9C27B0;
    color: white;
}

.share-btn:hover {
    background-color: #7B1FA2;
    transform: translateY(-2px);
}

/* 详细内容区域 */
.hanzi-details-section {
    background-color: white;
    padding: 2rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.hanzi-details-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.hanzi-details-section h2 i {
    color: var(--primary-color);
}

/* 笔画动画区域 */
.stroke-order-demo {
    text-align: center;
}

.stroke-controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
}

.stroke-btn {
    padding: 10px 20px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.stroke-btn:hover {
    background-color: #1976D2;
}

.stroke-btn.active {
    background-color: var(--primary-color);
}

/* 基本释义 */
.basic-meanings {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.meaning-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 6px;
}

.meaning-index {
    background: var(--primary-color);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.meaning-text {
    flex: 1;
    line-height: 1.6;
}

/* 未找到页面 */
.not-found {
    text-align: center;
    padding: 4rem 2rem;
    background-color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.not-found-icon {
    font-size: 4rem;
    color: var(--accent-color);
    margin-bottom: 1.5rem;
}

.not-found h2 {
    color: var(--dark-color);
    margin-bottom: 1rem;
    font-size: 2rem;
}

.not-found p {
    margin-bottom: 2rem;
    font-size: 1.1rem;
    color: var(--text-light);
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.not-found-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.btn {
    padding: 12px 24px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #388E3C;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #1976D2;
    transform: translateY(-2px);
}

.suggestions {
    margin-top: 2rem;
}

.suggestions p {
    margin-bottom: 1rem;
    color: var(--text-light);
}

.suggestions-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.suggestion-char {
    display: inline-block;
    width: 50px;
    height: 50px;
    line-height: 50px;
    background-color: #f0f0f0;
    color: var(--dark-color);
    border-radius: 50%;
    font-size: 1.5rem;
    text-decoration: none;
    transition: all 0.3s;
}

.suggestion-char:hover {
    background-color: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

/* 页脚 */
footer {
    background-color: var(--dark-color);
    color: white;
    padding: 3rem 0 1.5rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: white;
}

.footer-section p {
    opacity: 0.8;
    line-height: 1.6;
    font-size: 0.95rem;
}

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom p {
    opacity: 0.7;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.2rem;
    }
    
    .hanzi-header {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    
    .hanzi-display {
        flex-direction: column;
        gap: 1rem;
    }
    
    .big-hanzi {
        font-size: 5rem;
    }
    
    .hanzi-controls {
        flex-wrap: wrap;
    }
    
    .input-group {
        flex-direction: column;
        border-radius: var(--radius);
    }
    
    .input-group input {
        border-radius: var(--radius) var(--radius) 0 0;
        margin-bottom: 0;
    }
    
    .search-btn {
        border-radius: 0 0 var(--radius) var(--radius);
        width: 100%;
        justify-content: center;
    }
    
    nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 3rem 0;
    }
    
    .hero h1 {
        font-size: 1.8rem;
    }
    
    .hanzi-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .stats {
        grid-template-columns: 1fr;
    }
    
    .pinyin-display {
        justify-content: center;
    }
    
    .hanzi-stats {
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* 动画关键帧 */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* 打印样式 */
@media print {
    header, footer, .hanzi-controls, .stroke-controls {
        display: none;
    }
    
    .hanzi-details-section {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}