* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%; /* 关键：确保 html 元素也占据 100% 的高度 */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    min-height: 100vh;
    max-width: 1200px; 
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    /* flex-grow: 1;  移除 container 元素的 flex-grow 属性 */
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
}

header h1 {
    font-size: 2.5rem;
    color: #3498db;
    font-weight: 500;
}

main {
    margin-bottom: 40px;
    flex-grow: 1; /* 关键：添加到 main 元素 */
}

a {
    color: #42b983;
}

/* tagline 样式 */
.tagline {
    font-size: 1.1em;          /* 稍大的字体 */
    color: #777;              /* 柔和的颜色 */
    margin-top: 5px;           /* 与标题保持一定距离 */
    margin-bottom: 15px;        /* 与搜索框保持一定距离 */
    font-style: italic;       /* 斜体，更显特色 */
    text-align: center;        /* 居中对齐 */
  }

/* 搜索区域 */
.search-section {
    margin-bottom: 30px;
}

.search-container {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 30px;
    overflow: hidden;
}

.search-input {
    flex: 1;
    padding: 15px 20px;
    border: none;
    font-size: 1rem;
    outline: none;
}

.search-button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.search-button:hover {
    background-color: #2980b9;
}

/* 热门搜索关键词样式 */
.hot-search-section {
    margin-bottom: 20px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.hot-search-section h2 {
    font-size: 1.2rem;
    color: #3498db;
    margin-bottom: 10px;
    font-weight: 500;
}

.hot-search-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hot-search-keywords a {
    display: inline-block;
    padding: 8px 12px;
    background-color: #fff;
    color: #3498db;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.hot-search-keywords a:hover {
    background-color: #3498db;
    color: white;
}

/* 结果区域 */
.results-section {
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.results-section h2 {
    margin-bottom: 10px;
    color: #2c3e50;
    font-weight: 500;
}

.search-select {
    padding: 12px;
    font-size: 1rem;
    border: none;
    border-radius: 30px 0 0 30px;
    outline: none;
    background-color: #fff;
    cursor: pointer;
}

.results-container {
    margin-top: 10px;
    /* 修改这里，移除或设置为 1fr */
    grid-template-columns: 1fr;
    display: grid;
    /* display: flex; */
    align-items: center;
    gap: 5px;
}

.result-card {
    background-color: #f8f9fa;
    padding: 5px; /* 减少内边距 */
    border-radius: 5px; /* 稍微减小圆角 */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); /* 减少阴影 */
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 5px; /* 添加或减少底部外边距，以调整行间距 */
    display: flex;
    grid-template-columns: 1fr; /* 或者其他适合你的布局 */
    align-items: center; /* 垂直居中 */
}

.result-card:hover {
    transform: translateY(-2px); /* 减少悬停时的位移 */
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1); /* 减少悬停时的阴影 */
}

/* 图标的样式 */
.result-icon {
    width: 24px;  /* 设置图标的宽度 */
    height: 24px; /* 设置图标的高度 */
    margin-right: 10px; /* 图标与文字之间的间距 */
}

.result-card h3 {
    color: #3498db;
    margin-bottom: 5px; /* 减少标题下方的间距 */
    font-weight: 500;
    font-size: 1rem; /* 稍微减小标题字体大小 */
}

.result-card p {
    margin-bottom: 8px; /* 减少段落下方的间距 */
    color: #555;
    font-size: 0.9rem; /* 稍微减小段落字体大小 */
    line-height: 1.4; /* 稍微减小行高 */
}

.result-link {
    color: #3498db;
    font-weight: 500;
    padding: 3px 0; /* 减少链接的内边距 */
    border-bottom: 1px solid transparent; /* 减少边框粗细 */
    transition: border-color 0.3s;
    font-size: 0.9rem; /* 稍微减小链接字体大小 */
    text-decoration: none; /* 移除下划线 */
    border-bottom: none; /* 移除边框 */
}

.result-link h3 {
    display: flex; /* 应用于 h3 元素 */
    align-items: center; /* 应用于 h3 元素 */
    height: 100%; /* 确保 h3 元素占据链接的全部高度 */
    margin: 0; /* 移除 h3 元素的默认 margin */
}

.result-link:hover {
    border-color: #3498db;
    text-decoration: none; /* 悬停时也移除下划线 */
    border-bottom: none; /* 移除边框 */
}

.no-results {
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
}

/* 页脚 */
footer {
    text-align: center;
    padding: 20px 0;
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .results-container {
        grid-template-columns: 1fr; /* 确保在小屏幕上也是一列 */
    }
    
    .search-container {
        flex-direction: column;
        border-radius: 8px;
    }
    
    .search-input {
        width: 100%;
        border-radius: 8px 8px 0 0;
    }
    
    .search-button {
        width: 100%;
        padding: 12px;
        border-radius: 0 0 8px 8px;
    }
    /* 减少搜索区域的间距 */
    .search-section {
        margin-bottom: 15px; /* 原为30px */
    }

    /* 优化热门搜索区域 */
    .hot-search-section {
        margin-bottom: 10px; /* 原为20px */
        padding: 5px; /* 原为10px */
    }

    .hot-search-keywords {
        overflow-x: auto; /* 横向滚动 */
        white-space: nowrap; /* 单行显示 */
        gap: 5px; /* 原为8px */
    }

    .hot-search-keywords a {
        font-size: 0.8rem; /* 原为0.9rem */
        padding: 5px 8px; /* 原为8px 12px */
    }

    /* 减少结果区域的顶部间距 */
    .results-section {
        padding: 10px; /* 原为20px */
        margin-top: 0; /* 确保紧跟热门搜索 */
    }
}

/* 标题样式 */
.heading {
    color: #333;
}

/* 错误提示样式 */
.error-message {
    color: red;
    margin-bottom: 10px;
}

/* 结果区域高亮动画 */
@keyframes highlight {
    0% { background-color: #f8f9fa; }
    50% { background-color: #e3f2fd; }
    100% { background-color: #f8f9fa; }
}

.highlight-results {
    animation: highlight 1.5s ease;
}

.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    display: none;
    z-index: 999;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    opacity: 0.8;
    transition: opacity 0.3s;
}

.back-to-top:hover {
    opacity: 1;
}

/* 移动端优化 */
@media (max-width: 768px) {
    /* 减小头部和搜索部分的高度 */
    header {
        margin-bottom: 20px;
        padding: 10px 0;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .tagline {
        font-size: 0.9em;
        margin-top: 3px;
        margin-bottom: 10px;
    }
    
    /* 优化搜索框 */
    .search-section {
        margin-bottom: 10px;
    }
    
    .search-container {
        max-width: 100%;
    }
    
    .search-input, .search-button, .search-select {
        padding: 10px;
    }
    
    /* 热门搜索区域优化 */
    .hot-search-section {
        margin-bottom: 8px;
        padding: 5px;
    }
    
    .hot-search-section h2 {
        font-size: 1rem;
        margin-bottom: 5px;
    }
    
    /* 使热门搜索关键词更紧凑 */
    .hot-search-keywords {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .hot-search-keywords a {
        padding: 4px 8px;
        font-size: 0.8rem;
        margin-bottom: 2px;
    }
    
    /* 结果区样式调整 */
    .results-section {
        padding: 10px;
    }
    
    .result-card {
        padding: 8px;
        margin-bottom: 5px;
    }
    
    /* 更紧凑的声明区域 */
    footer div {
        min-height: 150px !important;
        padding: 5px !important;
    }
    
    footer div h2 {
        margin-bottom: 5px !important;
    }
    
    footer div p {
        font-size: 0.8em !important;
    }
}

/* 广告区域样式 */
.ad-section-top, 
.ad-section-bottom {
    margin: 20px 0;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
    text-align: center;
    clear: both;
}

.ad-in-results {
    margin: 10px 0;
    padding: 5px;
    background-color: #f8f9fa;
    border-radius: 5px;
    text-align: center;
}

/* 移动设备上的广告样式优化 */
@media (max-width: 768px) {
    .ad-section-top, 
    .ad-section-bottom {
        margin: 10px 0;
        padding: 5px;
    }
    
    .ad-in-results {
        margin: 5px 0;
    }
}

/* 添加微妙的标签标识广告 */
.ad-section-top::before,
.ad-section-bottom::before,
.ad-in-results::before {
    content: "";
    display: block;
    font-size: 0.7rem;
    color: #999;
    text-align: center;
    margin-bottom: 3px;
}

/* telegram-channel */
.telegram-channel-section {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.telegram-channel-section h2 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: #333;
    text-align: center;
}

.telegram-channels {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.telegram-link {
    background-color: #f0f0f0;
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 0.9rem;
    color: #42b983 !important;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
}

.telegram-link:hover {
    background-color: #e0e0e0;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .telegram-channels {
        flex-direction: column;
        align-items: center;
    }
}