@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}
.animate-pulse-custom {
    animation: pulse 2s infinite;
}
.animate-bounce-custom {
    animation: bounce 1.5s infinite;
}
.gradient-border {
    position: relative;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(45deg, #6366f1, #8b5cf6, #ec4899) border-box;
    border: 2px solid transparent;
    border-radius: 1rem;
}
.floating-element {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}
.floating-element:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
/* 每日挑战区域背景色加强 */
.daily-challenge-bg {
    background: linear-gradient(135deg, #f59e0b, #ea580c, #dc2626) !important;
    background-size: 200% 200% !important;
    animation: gradientShift 3s ease infinite !important;
}
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 古诗容器优化 */
#daily-poem .bg-white.bg-opacity-20.backdrop-blur-sm.rounded-xl.p-4.mb-4 {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    margin: 1rem 0;
    padding: 1.25rem !important;
    box-sizing: border-box;
}

/* 古诗标题优化 */
#poem-title {
    font-family: 'STSong', 'SimSun', '宋体', 'serif';
    text-align: center;
    width: 100%;
    margin-bottom: 0.5rem;
}

/* 古诗作者信息优化 */
#poem-author {
    text-align: center;
    width: 100%;
    margin-top: 0.25rem;
}
/* 排行榜数字样式 */
.ranking-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-weight: bold;
    font-size: 0.875rem;
    position: relative;
    z-index: 10;
}
/* 课程体系卡片样式 */
.course-card {
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
}

.course-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.course-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* 课程卡片容器样式 */
#card-container {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

#card-wrapper {
    scroll-snap-type: x mandatory;
}

.course-card {
    scroll-snap-align: start;
}

/* 自定义头部高度 */
.mobile-header {
    height: 3rem;
}

/* 倒计时警告效果 */
@keyframes countdownPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}
.countdown-warning {
    animation: countdownPulse 1s infinite;
}

/* 字体优化 */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-weight: 400;
    line-height: 1.6;
    font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* 标题字体优化 */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.4;
    font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* 古诗内容字体优化 */
#poem-content {
    font-family: 'STKaiti', 'KaiTi', '楷体', 'serif';
    font-size: clamp(0.7rem, 2vw, 1.1rem);
    line-height: 1.8;
    letter-spacing: 0.02em;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    margin: 0;
    padding: 1rem;
    box-sizing: border-box;
    word-break: keep-all;
    white-space: normal;
    overflow-wrap: break-word;
}

/* 古诗标题字体优化 */
#poem-title {
    font-family: 'STSong', 'SimSun', '宋体', 'serif';
}

/* 古诗区域标题字体优化 */
.poem-section-title {
    font-family: 'STSong', 'SimSun', '宋体', 'serif';
}

/* 古诗容器背景 */
.daily-poem-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    z-index: -1;
}

/* 古诗容器 */
.daily-poem-container {
    position: relative;
    overflow: hidden;
}

/* 古诗标题容器 */
.poem-title-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    width: 100%;
    text-align: center;
    margin-bottom: 0.75rem;
}

/* 在小屏幕上调整标题容器 */
@media (max-width: 480px) {
    .poem-title-container {
        flex-direction: column;
    }
    
    .poem-title {
        margin: 0.5rem 0;
    }
    
    .poem-author {
        margin-top: 0;
    }
}

/* 古诗标题 */
.poem-title {
    font-family: 'STSong', 'SimSun', '宋体', 'serif';
    text-align: center;
    flex: 1;
    min-width: 0;
}

/* 古诗作者 */
.poem-author {
    text-align: center;
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

/* 古诗内容容器 */
.poem-content-container {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    border-radius: 0.75rem;
    padding: 1rem;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    width: 100%;
}

/* 移动端字体大小优化 */
@media (max-width: 768px) {
    .text-base {
        font-size: 0.95rem;
    }
    .text-lg {
        font-size: 1.125rem;
    }
    .text-xl {
        font-size: 1.25rem;
    }
    .text-2xl {
        font-size: 1.5rem;
    }
    #poem-content {
        font-size: 1rem;
        padding: 1rem;
        min-height: 110px;
    }
}

@media (max-width: 480px) {
    .text-xs {
        font-size: 0.7rem;
    }
    .text-sm {
        font-size: 0.8rem;
    }
    .text-base {
        font-size: 0.9rem;
    }
    .text-lg {
        font-size: 1rem;
    }
    .text-xl {
        font-size: 1.1rem;
    }
    #poem-content {
        font-size: 0.9rem;
        padding: 0.875rem;
        min-height: 100px;
    }
}

/* 小屏幕优化 */
@media (max-width: 375px) {
    #poem-content {
        font-size: 0.85rem;
        padding: 0.75rem;
        min-height: 90px;
    }
    
    .poem-content-container {
        padding: 0.75rem;
        min-height: 140px;
    }
    
    .poem-author {
        font-size: 0.75rem;
    }
}

/* 大屏手机优化 */
@media (min-width: 414px) and (max-width: 768px) {
    #poem-content {
        font-size: 1.05rem;
        padding: 1.25rem;
        min-height: 130px;
    }
    
    .poem-content-container {
        padding: 1.25rem;
        min-height: 180px;
    }
    
    .poem-author {
        font-size: 1rem;
    }
}

/* 平板优化 */
@media (min-width: 768px) and (max-width: 1024px) {
    #poem-content {
        font-size: 1.1rem;
        padding: 1.5rem;
        min-height: 140px;
    }
    
    .poem-content-container {
        padding: 1.5rem;
        min-height: 200px;
    }
    
    .poem-author {
        font-size: 1.125rem;
    }
}

/* 大屏优化 */
@media (min-width: 1024px) {
    #poem-content {
        font-size: 1.15rem;
        padding: 2rem;
        min-height: 220px;
    }
    
    .poem-author {
        font-size: 1.25rem;
    }
}



/* 搜索建议项样式 */
.suggestion-item {
    transition: background-color 0.2s ease;
}

.suggestion-item:hover {
    background-color: #f3f4f6;
}

/* 搜索建议容器样式 */
#search-suggestions {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid #e5e7eb;
    max-height: 70vh; /* 限制最大高度为视口高度的70% */
    overflow-y: auto; /* 允许垂直滚动 */
}

/* 搜索建议标题样式 */
#search-suggestions .text-gray-500 {
    color: #6b7280;
}

/* 热门搜索区域样式 */
.hot-searches-section {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding: 1rem;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
    
    /* 添加微妙的浮动效果 */
    animation: sectionFloat 8s ease-in-out infinite;
    transform: translateZ(0); /* 启用硬件加速 */
}

/* 区域浮动动画 */
@keyframes sectionFloat {
    0% {
        transform: translateY(0px) translateZ(0);
    }
    50% {
        transform: translateY(-5px) translateZ(0);
    }
    100% {
        transform: translateY(0px) translateZ(0);
    }
}

/* 热门搜索链接样式 - 确保在不同移动端尺寸下水平垂直居中对齐 */
.hot-search-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    font-size: 0.75rem;
    line-height: 1.25;
    padding: 0.25rem 0.75rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 0 0 auto;
    vertical-align: middle;
    text-align: center;
    box-sizing: border-box;
    min-height: 0;
    height: auto;
    white-space: nowrap;
    margin: 0;
    
    /* 添加动态效果 */
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
}

/* 淡入上升动画 */
@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 浮动动画 */
@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-3px);
    }
    100% {
        transform: translateY(0px);
    }
}

/* 脉冲动画 */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.03);
    }
    100% {
        transform: scale(1);
    }
}

.hot-search-link:hover {
    opacity: 0.8;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    animation: pulse 0.5s ease-in-out;
}

.hot-search-link:focus {
    outline: none;
}

/* 热门搜索容器样式 - 确保在不同屏幕尺寸下合理分布 */
#hot-searches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    line-height: 1;
    padding: 0.25rem 0;
    width: 100%;
    box-sizing: border-box;
}

#hot-searches .hot-search-link {
    align-self: center;
}

/* 为热门搜索标签添加浮动效果 */
.hot-search-link:nth-child(3n+1) {
    animation: float 3s ease-in-out infinite, fadeInUp 0.6s ease-out forwards;
}

.hot-search-link:nth-child(3n+2) {
    animation: float 4s ease-in-out infinite, fadeInUp 0.6s ease-out forwards;
}

.hot-search-link:nth-child(3n+3) {
    animation: float 5s ease-in-out infinite, fadeInUp 0.6s ease-out forwards;
}

/* 小屏幕优化 */
@media (max-width: 480px) {
    #hot-searches {
        gap: 0.375rem;
        padding: 0.125rem 0;
    }
    
    .hot-search-link {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
    }
}

/* 大屏手机优化 */
@media (min-width: 414px) and (max-width: 768px) {
    #hot-searches {
        gap: 0.625rem;
        padding: 0.3125rem 0;
    }
    
    .hot-search-link {
        font-size: 0.75rem;
        padding: 0.25rem 0.75rem;
    }
}

/* 平板优化 */
@media (min-width: 768px) and (max-width: 1024px) {
    #hot-searches {
        gap: 0.75rem;
        padding: 0.375rem 0;
    }
    
    .hot-search-link {
        font-size: 0.8rem;
        padding: 0.3rem 0.85rem;
    }
}

/* 大屏优化 */
@media (min-width: 1024px) {
    #hot-searches {
        gap: 0.875rem;
        padding: 0.4375rem 0;
    }
    
    .hot-search-link {
        font-size: 0.85rem;
        padding: 0.35rem 0.95rem;
    }
}

/* 超大屏优化 */
@media (min-width: 1200px) {
    #hot-searches {
        gap: 1rem;
        padding: 0.5rem 0;
    }
    
    .hot-search-link {
        font-size: 0.9rem;
        padding: 0.4rem 1rem;
    }
}

/* 小屏幕优化 */
@media (max-width: 480px) {
    #search-suggestions {
        max-height: 60vh; /* 在小屏幕上进一步限制高度 */
    }
}

/* 大屏手机优化 */
@media (min-width: 414px) and (max-width: 768px) {
    #search-suggestions {
        max-height: 65vh; /* 在大屏手机上适度增加高度 */
    }
}

/* 平板优化 */
@media (min-width: 768px) and (max-width: 1024px) {
    #search-suggestions {
        max-height: 70vh; /* 在平板上使用标准高度 */
    }
}

/* 大屏优化 */
@media (min-width: 1024px) {
    #search-suggestions {
        max-height: 75vh; /* 在大屏幕上允许更多内容显示 */
    }
}
