:root {
    --text-color: #333;
    --card-bg: #fff;
    --border-color: #ddd;
    --link-color: #007bff;
    --hover-color: #0056b3;
    --search-bg: #f5f5f5;
    --icon-color: #333;
}

body.dark-mode {
    --text-color: #e0e0e0;
    --card-bg: #2b2b2b;
    --border-color: #444;
    --link-color: #4da6ff;
    --hover-color: #66baff;
    --search-bg: #3c3c3c;
    --icon-color: #e0e0e0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-color);
    margin: 0;
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
}

#background-video {
    position: fixed; /* 固定位置，不随滚动条移动 */
    right: 0;
    bottom: 0;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: -1; /* 将视频放在最底层 */
    background-size: cover;
}

/* 创建一个覆盖全屏的模糊层 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 使用 backdrop-filter 确保它只模糊它下面的内容，也就是视频 */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); /* 兼容 Safari */
    background: rgba(255, 255, 255, 0.3); /* 浅色半透明背景 */
    z-index: -1; /* 放在视频和内容之间 */
    transition: background-color 0.3s ease;
}

body.dark-mode::before {
    background: rgba(0, 0, 0, 0.3); /* 深色半透明背景 */
}

.main-content {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    padding: 20px 20px 80px;
    box-sizing: border-box;
    position: relative;
    z-index: 1; /* 确保内容在模糊层之上 */
    background: transparent; /* 内容容器本身无背景 */
}

/* 保持卡片和按钮的背景色不变 */
.link-item,
.tags-container button,
.search-box input {
    background-color: var(--card-bg);
    /* ... 其余样式不变 ... */
}

/* 其余样式保持不变 */
.header {
    margin-bottom: 40px;
}

.header-title {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.header-title h1 {
    font-size: 2.5em;
    margin: 0 10px;
}

.header p {
    margin: 0;
}

.search-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
}

.search-box {
    position: relative;
    display: flex;
    width: 100%;
    max-width: 600px;
}

.search-box input {
    flex-grow: 1;
    padding: 18px 20px 18px 50px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px;
    background-color: var(--card-bg);
    color: var(--text-color);
    transition: box-shadow 0.3s;
}

.search-box input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.search-logo {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    pointer-events: none;
}

.search-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    padding: 5px 10px;
    border-radius: 20px;
    background-color: var(--search-bg);
    color: var(--text-color);
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-toggle:hover {
    background-color: var(--border-color);
}

.tags-container {
    margin-bottom: 20px;
}

.tags-container button {
    padding: 8px 16px;
    margin: 0 5px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background-color: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}

.tags-container button.active {
    background-color: var(--link-color);
    color: #fff;
    border-color: var(--link-color);
}

.tags-container button:hover {
    background-color: var(--link-color);
    color: #fff;
}

.links-grid {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.links-grid.active {
    display: grid;
}

.link-item {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 15px;
    text-decoration: none;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.link-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--link-color);
}

.link-item img {
    width: 40px;
    height: 40px;
    margin-bottom: 8px;
}

.link-item span {
    font-size: 0.9em;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 0.8em;
    color: #888;
    padding: 20px;
    box-sizing: border-box;
}

.dark-mode-toggle {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    cursor: pointer;
    transition: transform 0.2s;
}

.dark-mode-toggle svg {
    width: 24px;
    height: 24px;
    fill: var(--icon-color);
    transition: fill 0.3s;
}

.dark-mode-toggle:hover {
    transform: scale(1.1);
}

.dark-mode-toggle:focus {
    outline: none;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .main-content {
        padding: 10px;
    }
    .header h1 {
        font-size: 2em;
    }
    .links-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    .search-box input {
        padding: 12px 20px;
    }
    .search-toggle {
        display: none;
    }
}