* {
    margin: 0;
    padding: 0;
    font-family: "微软雅黑";
}

body, ul, li, h1, h2, h3, h4, h5, h6, p, form, dl, dt, dd {
    margin: 0px;
    padding: 0px;
    font-size: 14px;
    font-weight: normal;
}

img {
    border-style: none;
}

li {
    list-style: none;
    float: left;
}

a {
    text-decoration: none;
}

body {
    background: linear-gradient(30deg, #73bdbd, #869c8a);
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

.container {
    padding: 20px;
    border-radius: 8px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.search-container {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    width: 100%;
    max-width: 600px; /* 设置搜索框加按钮的最大宽度 */
    box-sizing: border-box;
}

#engine-button {
    padding: 10px;
    border: none;
    background-color: #f4f4f4;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s;
    flex: 1;
    font-size: clamp(10px, 3vw, 16px); /* 动态调整字体大小 */
}

#engine-button:hover {
    background-color: #e0e0e0;
    transform: scale(1.05);
}

#search {
    flex: 2;
    padding: 10px;
    border: none;
    font-size: clamp(10px, 3vw, 16px); /* 动态调整字体大小 */
    background: rgba(255, 255, 255, 0.2);
    color: rgb(71, 6, 6);
    font-weight: bold;
}

#search-button {
    padding: 10px;
    border: none;
    background-color: #3385ff;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s;
    flex: 1;
    font-size: clamp(10px, 3vw, 16px); /* 动态调整字体大小 */
}

#search-button:hover {
    background-color: #2d78f4;
}

#search-button:active {
    background-color: #286090;
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.3);
}

#links {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

.category {
    flex: 1 1 calc(28%);
    max-width: calc(33%);
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 保持3列布局 */
    gap: 14px;
    padding: 10px;
    border-radius: 4px;
    background-color: transparent;
    height: calc((2 / 3) * 100%); /* 默认高度为2/3 */
}

/* 当有9个链接时，高度为3/3（100%） */
.category:has(.link-card:nth-child(9)) {
    height: 100%;
}

.link-card {
    background-color: rgba(240, 240, 240, 0.3);
    padding: 2px;
    border-radius: 8px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    text-align: center;
    font-size: clamp(8px, 3vw, 14px);
    white-space: nowrap;
}


@media (max-width: 850px) {
    .category {
        flex: 1 1 33%;
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    .category {
        flex: 1 1 100%;
        max-width: 100%;
    }
}

.link-card {
    background-color: rgba(240, 240, 240, 0.3);
    padding: 2px;
    border-radius: 8px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    text-align: center;
    font-size: clamp(8px, 3vw, 14px); /* 动态调整字体大小 */
    white-space: nowrap; /* 防止文本换行 */
}

.link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.link-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    transition: transform 0.3s;
    pointer-events: none;
}

.link-card:hover::before {
    transform: scale(1);
}

.link-card a {
    padding: 2px;
    border-radius: 8px;
    color: #333;
    text-decoration: none;
    font-weight: bold;
    display: block;
    font-size: clamp(10px, 3vw, 14px); /* 动态调整字体大小 */
    white-space: nowrap; /* 防止文本换行 */
    width: 100%; /* 确保宽度与 .category 一致 */
    height: 100%; /* 确保高度与 .category 一致 */
}

.category h2 {
    grid-column: 1 / -1;
    color: #555;
    font-size: clamp(10px, 3vw, 16px); /* 动态调整字体大小 */
    margin-bottom: 15px;
    text-align: center;
}

/* 清空搜索框按钮样式 */
.clear-search-button {
    display: none; /* 默认隐藏 */
    position: absolute;
    right: 27%; /* 调整到搜索框右侧 */
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #ccc;
    border: none;
    cursor: pointer;
    outline: none;
    font-size: 12px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-search-button::before {
    content: '×'; /* 使用 Unicode 字符 '×' 表示 X */
}

.clear-search-button:hover {
    background-color: #aaa;
}
