:root {
    --primary-color: #000;
    --secondary-color: #fff;
    --accent-color: #333;
    --text-color: #333;
}

body, html {
    font-family: 'Noto Sans SC', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    height: 100%;
    background-color: var(--secondary-color);
    color: var(--text-color);
}

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 95vh;
    padding: 0.5rem;
}

.search-card {
    width: 100%;
    max-width: 600px;
    padding: 1.5rem;
    background: var(--secondary-color);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.logo-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo {
    width: 40px;
    height: 40px;
    margin-right: 10px;
    margin-top: -22px; /* 向上移动图片 */
}

.title-wrapper {
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

h1 {
    font-size: 2rem; /* 减小标题字体大小 */
    color: var(--primary-color);
    margin: 0; /* 移除上下边距 */
}

.subtitle {
    font-size: 1rem;
    color: var(--accent-color);
    margin: 0; /* 移除上下边距 */
    padding-left: 25px; /* 向右移动副标题 */
}

#search-form {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
}

.search-input-wrapper {
    display: flex;
    margin-bottom: 0.8rem;
}

#search-input {
    flex-grow: 1;
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
    border: 1px solid var(--primary-color);
    border-right: none;
    border-radius: 4px 0 0 4px;
    outline: none;
}

button {
    padding: 0.6rem 1.2rem;
    background-color: var(--primary-color);
    color: var(--secondary-color);
    border: 1px solid var(--primary-color);
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: var(--accent-color);
}

#results {
    background-color: var(--secondary-color);
    padding: 0.8rem;
    border-radius: 4px;
}

.search-result {
    margin-bottom: 1.2rem;
    padding: 0.8rem;
    border-bottom: 1px solid #eee;
    background-color: var(--secondary-color); /* 白色背景 */
}

.search-result:last-child {
    border-bottom: none;
}

.search-result h3 {
    margin-bottom: 0.3rem;
    font-size: 1.1rem; /* 稍大一点的标题 */
    color: var(--primary-color);
}

.search-result a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
}

.search-result a:hover {
    text-decoration: underline;
}

.search-result p {
    color: var(--text-color);
    font-size: 0.9rem;
}

.ai-summary {
    background-color: #e6f2ff; /* 淡蓝色背景 */
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.2rem;
    color: #333333; /* 深色文字，确保在浅色背景上可读 */
    font-size: 0.85rem; /* 比搜索结果稍小的字体 */
}

.ai-summary h2 {
    color: #1a5f7a; /* 深蓝色标题 */
    margin-top: 0;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    position: relative;
}

.loading-spinner::before,
.loading-spinner::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--primary-color);
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-spinner::after {
    animation-delay: -0.75s;
}

@keyframes pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

.search-result, .ai-summary {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.search-result.show, .ai-summary.show {
    opacity: 1;
    transform: translateY(0);
}

.ai-summary sup {
    font-size: 0.8em; /* 稍微增大字体大小 */
    vertical-align: super;
    line-height: 0;
    margin: 0 2px; /* 添加一些间距 */
}

.ai-summary sup a {
    color: #ff0000;
    text-decoration: none;
    background-color: #ffffff00; /* 添加背景色 */
    padding: 1px 1px; /* 添加内边距 */
    border-radius: 3px; /* 添加圆角 */
    transition: background-color 0.3s ease; /* 添加过渡效果 */
}

.ai-summary sup a:hover {
    background-color: #b3d9ff; /* 鼠标悬停时改变背景色 */
    text-decoration: none; /* 移除下划线 */
}

@media (max-width: 600px) {
    .container {
        padding: 0.5rem;
    }

    .search-card {
        padding: 0.8rem;
        max-width: 100%;
        box-shadow: none;
    }

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

    .subtitle {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }

    #search-form {
        margin-bottom: 1rem;
    }

    .search-input-wrapper {
        flex-direction: row;
        margin-bottom: 0.5rem;
    }

    #search-input {
        border: 1px solid var(--primary-color);
        border-right: none;
        border-radius: 4px 0 0 4px;
        margin-bottom: 0;
        font-size: 0.9rem;
        padding: 0.6rem;
        flex-grow: 1;
    }

    button {
        border-radius: 0 4px 4px 0;
        width: auto;
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    #results {
        padding: 0;
    }

    .search-result, .ai-summary {
        padding: 0.8rem;
        margin-bottom: 0.8rem;
        border-radius: 6px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    .search-result h3 {
        font-size: 0.9rem;
        margin-bottom: 0.2rem;
    }

    .search-result p, .ai-summary p {
        font-size: 0.8rem;
        line-height: 1.4;
    }

    .ai-summary h2 {
        font-size: 1rem;
        margin-bottom: 0.3rem;
    }

    .logo {
        width: 30px;
        height: 30px;
        margin-right: 8px;
        margin-top: -18px; /* 在移动端稍微向上移动图片 */
    }

    h1 {
        font-size: 1.5rem; /* 进一步减小移动端的标题字体大小 */
        margin: 0; /* 移除上下边距 */
    }

    .subtitle {
        font-size: 0.8rem;
        margin: 0; /* 移除上下边距 */
        padding-left: 13px; /* 在移动端稍微向右移动副标题 */
    }
}