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

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

a {
    text-decoration: none;
    color: #1890ff;
    transition: color 0.3s;
}

a:hover {
    color: #40a9ff;
}

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

/* 头部 */
.header {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 临时emoji图标样式 */
.logo-icon {
    font-size: 32px;
    line-height: 1;
    display: inline-block;
}

/* 正式Logo图片样式（制作好图片后使用） */
.logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.logo a {
    font-size: 24px;
    font-weight: bold;
    color: #1890ff;
}

.nav {
    display: flex;
    gap: 30px;
}

.nav a {
    color: #333;
    font-weight: 500;
}

.nav a:hover {
    color: #1890ff;
}

/* 英雄区域 */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 60px 0;
    text-align: center;
}

.hero-title {
    font-size: 48px;
    margin-bottom: 15px;
}

.hero-subtitle {
    font-size: 18px;
    margin-bottom: 40px;
    opacity: 0.9;
}

/* 搜索框 */
.search-box {
    max-width: 600px;
    margin: 0 auto 25px;
    display: flex;
    background: #fff;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

#searchInput {
    flex: 1;
    padding: 15px 25px;
    border: none;
    font-size: 16px;
    outline: none;
}

#searchBtn {
    padding: 15px 35px;
    background: #1890ff;
    color: #fff;
    border: none;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

#searchBtn:hover {
    background: #40a9ff;
}

/* 热门关键词 */
.hot-keywords {
    color: rgba(255,255,255,0.9);
}

.hot-keywords .label {
    margin-right: 10px;
}

.hot-keywords a {
    color: #fff;
    margin: 0 8px;
    padding: 5px 12px;
    background: rgba(255,255,255,0.2);
    border-radius: 15px;
    font-size: 14px;
    display: inline-block;
    margin-bottom: 5px;
}

.hot-keywords a:hover {
    background: rgba(255,255,255,0.3);
}

/* 快速导航 */
.quick-nav {
    background: #fff;
    padding: 50px 0;
}

.section-title {
    font-size: 28px;
    margin-bottom: 30px;
    color: #333;
    text-align: center;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: #1890ff;
    margin: 10px auto 0;
}

.nav-group {
    margin-bottom: 40px;
}

.nav-group h4 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #555;
}

/* 字母导航 */
.letter-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.letter-nav a {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    background: #f0f2f5;
    border-radius: 5px;
    font-weight: bold;
    color: #333;
}

.letter-nav a:hover {
    background: #1890ff;
    color: #fff;
}

/* 数字导航 */
.number-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.number-nav a {
    padding: 10px 25px;
    background: #f0f2f5;
    border-radius: 20px;
    color: #333;
}

.number-nav a:hover {
    background: #1890ff;
    color: #fff;
}

/* 分类导航 */
.category-nav {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.category-nav a {
    padding: 12px 20px;
    background: #f0f2f5;
    border-radius: 8px;
    text-align: center;
    color: #333;
    transition: all 0.3s;
}

.category-nav a:hover {
    background: #1890ff;
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(24,144,255,0.3);
}

/* 热门成语 */
.hot-chengyu {
    background: #f5f7fa;
    padding: 50px 0;
}

.chengyu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.chengyu-card {
    background: #fff;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.chengyu-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.chengyu-card h4 {
    font-size: 22px;
    color: #333;
    margin-bottom: 8px;
}

.chengyu-card .pinyin {
    color: #999;
    font-size: 14px;
    margin-bottom: 12px;
}

.chengyu-card .desc {
    color: #666;
    font-size: 14px;
    line-height: 1.8;
}

/* 成语接龙 */
.jielong-section {
    background: #fff;
    padding: 50px 0;
}

.jielong-demo {
    background: #f5f7fa;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
}

.jielong-chain {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.jielong-item {
    padding: 10px 20px;
    background: #fff;
    border-radius: 20px;
    color: #1890ff;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.jielong-item:hover {
    background: #1890ff;
    color: #fff;
}

.arrow {
    color: #1890ff;
    font-size: 20px;
    font-weight: bold;
}

.more-link {
    display: inline-block;
    padding: 10px 30px;
    background: #1890ff;
    color: #fff;
    border-radius: 20px;
    margin-top: 10px;
}

.more-link:hover {
    background: #40a9ff;
}

/* 页脚 */
.footer {
    background: #2c3e50;
    color: #fff;
    padding: 50px 0 20px;
}

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

.footer-col h5 {
    font-size: 18px;
    margin-bottom: 15px;
}

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

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col a {
    color: rgba(255,255,255,0.7);
    font-size: 14px;
}

.footer-col a:hover {
    color: #fff;
}

.copyright {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.copyright p {
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    margin: 5px 0;
}

/* 响应式设计 */
/* 移动端优化 - 防止横向滚动 */
@media (max-width: 768px) {
    /* 防止横向滚动 */
    html, body {
        overflow-x: hidden;
        max-width: 100%;
        width: 100%;
    }
    
    /* 全局容器 */
    .container {
        padding: 0 15px;
        max-width: 100%;
        width: 100%;
        overflow-x: hidden;
    }
    
    /* 确保所有元素不溢出 */
    img, video, iframe, embed, object {
        max-width: 100%;
        height: auto;
    }
    
    /* 防止长文本溢出 */
    p, div, span, a, li {
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
    }
    
    /* 头部导航 */
    .header .container {
        flex-direction: column;
        gap: 15px;
        padding: 12px 15px;
    }

    .nav {
        gap: 15px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav a {
        font-size: 14px;
    }
    
    .logo a {
        font-size: 20px;
    }

    /* 英雄区域 */
    .hero {
        padding: 40px 0;
    }
    
    .hero-title {
        font-size: 32px;
        line-height: 1.3;
    }

    .hero-subtitle {
        font-size: 16px;
        line-height: 1.5;
    }
    
    /* 搜索框 */
    .search-box {
        max-width: 100%;
    }
    
    .search-box input {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .search-box button {
        padding: 12px 20px;
        font-size: 14px;
    }

    /* 字母导航 */
    .letter-nav {
        gap: 6px;
        padding: 15px 0;
    }
    
    .letter-nav a {
        width: 35px;
        height: 35px;
        line-height: 35px;
        font-size: 14px;
    }

    /* 成语网格 */
    .chengyu-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .chengyu-card {
        padding: 20px 15px;
    }
    
    .chengyu-card h3 {
        font-size: 20px;
    }
    
    .chengyu-card .pinyin {
        font-size: 12px;
    }
    
    .chengyu-card .explanation {
        font-size: 14px;
    }

    /* 成语接龙 */
    .jielong-chain {
        flex-direction: column;
        gap: 10px;
    }

    .arrow {
        transform: rotate(90deg);
    }
    
    .jielong-card {
        padding: 20px 15px;
    }
    
    .jielong-card h4 {
        font-size: 18px;
    }
    
    /* 分类网格 */
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .category-card {
        padding: 20px 15px;
    }
    
    .category-card h3 {
        font-size: 16px;
    }
    
    .category-card .count {
        font-size: 12px;
    }
    
    /* 页脚 */
    .footer {
        padding: 30px 0 20px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 25px;
    }
    
    .footer-section h4 {
        font-size: 16px;
    }
    
    .footer-links a {
        font-size: 13px;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .header .container {
        padding: 10px;
    }
    
    .hero-title {
        font-size: 26px;
    }
    
    .hero-subtitle {
        font-size: 14px;
    }
    
    .search-box {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-box input,
    .search-box button {
        width: 100%;
    }
    
    .letter-nav a {
        width: 30px;
        height: 30px;
        line-height: 30px;
        font-size: 12px;
    }
    
    .category-grid {
        grid-template-columns: 1fr;
    }
    
    .nav {
        gap: 10px;
    }
}

