/* === 全局与通用样式 === */
html {
    scroll-behavior: smooth; /* 平滑滚动效果 */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

.status-bar-fill { /* iOS 状态栏填充 */
    height: env(safe-area-inset-top);
    background-color: #FF6B6B; /* 与头部颜色一致 */
}

.container { /* 通用内容容器 */
    padding: 15px;
    box-sizing: border-box;
}

.search-input-area { /* 这是 input 和 button 的主要 flex 容器 */
    display: flex;
    margin: 10px;
}

.search-field-wrapper {
    position: relative; 
    flex-grow: 1;      
    display: flex;     
}

/* 搜索框 input 样式 */
.search-input-area input[type="text"] {
    flex-grow: 1;
    padding: 12px 38px 12px 15px; /* 右侧内边距增大 (例如 38px) 为清除按钮图标留出空间 */
    border: 1px solid #ddd;
    border-radius: 25px 0 0 25px;
    font-size: 16px;
    outline: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    width: 100%;
}

.search-input-area input[type="text"]:focus {
    border-color: #FF6B6B;
    box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.2);
}
.clear-search-btn { /* 清除按钮(SVG图标容器)样式 */
    position: absolute;
    right: 10px; /* 图标距离输入框右边缘的距离 */
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #999;     /* SVG 默认颜色 */
    display: none;   /* 默认隐藏，由 JS 控制显示 */
    user-select: none;
    width: 16px;     /* 设置图标容器宽度 */
    height: 16px;    /* 设置图标容器高度 */
    /* 以下属性用于更好地显示和对齐SVG */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px; /* 轻微增加点击区域，但不影响图标本身大小 */
}
.clear-search-btn svg { /* SVG 图标本身的样式 */
    display: block; /* 移除SVG下方可能存在的额外空间 */
    width: 100%;    /* SVG 宽度充满其父容器 span */
    height: 100%;   /* SVG 高度充满其父容器 span */
}
.clear-search-btn:hover {
    color: #555;     /* 鼠标悬停时SVG颜色加深 */
}

.search-input-area button { /* 搜索按钮样式 (基本不变) */
    padding: 12px 18px;
    background-color: #FFC107;
    color: #333;
    border: 1px solid #FFC107;
    border-left: none; /* 这个很重要，因为输入框和按钮是分开的 */
    border-radius: 0 25px 25px 0; /* 搜索按钮的右侧圆角 */
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    -webkit-appearance: none;
    flex-shrink: 0; /* 防止搜索按钮被压缩 */
}


.results-card { /* 通用结果卡片样式 (主要用于 search_results.html) */
    background-color: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-bottom: 15px;
}

.loading-text, .error-text, .no-results { /* 通用提示文本 */
    text-align: center;
    color: #666;
    padding: 30px 15px;
    font-size: 15px;
}

/* 返回顶部按钮样式 (用于 search_results.html, 但也可全局使用) */
.scroll-to-top-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: rgba(255, 107, 107, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 20px;
    text-align: center;
    line-height: 45px;
    cursor: pointer;
    display: none;
    z-index: 999;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: opacity 0.3s, visibility 0.3s;
}
.scroll-to-top-btn:hover {
    background-color: #FF6B6B;
}

/* === index.html 专属样式 === */
.index-top-section { /* 首页顶部区域 */
    background-color: #FF6B6B;
    color: white;
    padding: 25px 20px calc(25px + env(safe-area-inset-top));
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.index-top-section h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.index-container { /* 首页主容器的特定内边距 */
    width: 100%;
    padding: 0 15px; 
    box-sizing: border-box;
}

.index-search-section { /* 首页搜索框的外部包裹卡片 */
    background-color: #fff;
    padding: 20px 15px;
    margin-top: -10px; 
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: relative;
    z-index: 10;
}

.hot-dreams-section { /* 首页热门梦境区域 */
    margin-top: 25px;
    padding: 20px 15px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.hot-dreams-section h2 {
    font-size: 18px;
    color: #333;
    margin-top: 0;
    margin-bottom: 15px;
    font-weight: 600;
}
.hot-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}
.hot-tags .tag {
    background-color: #e9ecef;
    color: #495057;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}
.hot-tags .tag:hover, .hot-tags .tag:active {
    background-color: #FF6B6B;
    color: white;
}
.refresh-hot-tags {
    display: block;
    width: fit-content;
    margin: 15px auto 0;
    padding: 10px 20px;
    color: #FF6B6B;
    background-color: transparent;
    border: 1px solid #FF6B6B;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}
.refresh-hot-tags:hover, .refresh-hot-tags:active {
    background-color: #FF6B6B;
    color: white;
}


/* === search_results.html 专属样式 === */
.results-header-bar { /* 结果页顶部导航栏 */
    background-color: #FF6B6B;
    color: white;
    padding: 10px 15px calc(10px + env(safe-area-inset-top));
    display: grid;
    grid-template-columns: auto 1fr auto; 
    align-items: center;
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}
.results-header-bar .back-button {
    font-size: 28px;
    color: white;
    text-decoration: none;
    padding: 5px;
    font-weight: bold;
    grid-column: 1;
    justify-self: start;
}
.results-header-bar .page-title {
    font-size: 18px;
    margin: 0;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    grid-column: 2;
}

.results-search-section { /* 结果页搜索框的外部包裹卡片 */
    background-color: #fff;
    padding: 15px; 
    margin-bottom: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* 精准匹配区域 */
#preciseMatchOutput {
     min-height: 100px;
}
.precise-match-card .dream-title-main { /* 这个类名可以考虑改为 #preciseMatchOutput .dream-title-main */
    font-size: 22px;
    color: #FF6060;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
}
.precise-match-card .dream-numbers { /* #preciseMatchOutput .dream-numbers */
    font-size: 18px;
    color: #333;
    text-align: center;
    line-height: 1.8;
}
.precise-match-card .dream-numbers span { /* #preciseMatchOutput .dream-numbers span */
    display: block;
}

/* 相关梦境区域 */
.related-dreams-section h2 { /* .results-card.related-dreams-section h2 */
    font-size: 18px;
    color: #333;
    margin-top: 0;
    margin-bottom: 15px;
    font-weight: 600;
}
.related-dreams-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.related-dreams-list li {
    background-color: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    padding: 8px;
    box-sizing: border-box;
    width: calc(50% - 5px);
    display: flex;
    flex-direction: row;
    align-items: flex-start; 
    cursor: pointer;
    transition: box-shadow 0.2s ease-in-out;
}
.related-dreams-list li:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.related-dreams-list li img {
    width: 50px;
    height: 50px; 
    object-fit: cover;
    border-radius: 6px;
    margin-right: 8px;
    flex-shrink: 0;
}
.related-dreams-list li .item-details {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: visible; 
}
.related-dreams-list li .item-details .dream-title {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    text-align: left;
}
.related-dreams-list li .item-details .dream-numbers-related {
    font-size: 11px;
    color: #555;
    line-height: 1.3;
    text-align: left;
    word-break: break-all;
}
.related-dreams-list li .item-details .dream-numbers-related span {
    display: block;
}
.related-dreams-list:after {
    content: "";
    flex-basis: calc(50% - 5px);
}



.page-disclaimer {
    text-align: center; /*!确保此行存在，用于文本居中 */
    font-size: 12px;
    color: #888;
    padding: 10px 15px; 
    margin-top: 15px;
    margin-bottom: 15px;
    background-color: transparent;
}
