:root {
    --bg-light: #f5f5f7;
    --text-light: #1d1d1f;
    --card-bg-light: rgba(255, 255, 255, 0.7);
    --accent-light: #5766f2;
    --border-light: rgba(0, 0, 0, 0.1);
    --shadow-light: rgba(0, 0, 0, 0.05);
    
    --bg-dark: #1d1d1f;
    --text-dark: #f5f5f7;
    --card-bg-dark: rgba(40, 40, 45, 0.7);
    --accent-dark: #6c7fff;
    --border-dark: rgba(255, 255, 255, 0.1);
    --shadow-dark: rgba(0, 0, 0, 0.2);
    
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    
    --bg: var(--bg-light);
    --text: var(--text-light);
    --card-bg: var(--card-bg-light);
    --accent: var(--accent-light);
    --border: var(--border-light);
    --shadow: var(--shadow-light);
    
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: var(--bg-dark);
        --text: var(--text-dark);
        --card-bg: var(--card-bg-dark);
        --accent: var(--accent-dark);
        --border: var(--border-dark);
        --shadow: var(--shadow-dark);
    }
}

.dark-theme {
    --bg: var(--bg-dark);
    --text: var(--text-dark);
    --card-bg: var(--card-bg-dark);
    --accent: var(--accent-dark);
    --border: var(--border-dark);
    --shadow: var(--shadow-dark);
}

.light-theme {
    --bg: var(--bg-light);
    --text: var(--text-light);
    --card-bg: var(--card-bg-light);
    --accent: var(--accent-light);
    --border: var(--border-light);
    --shadow: var(--shadow-light);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    overscroll-behavior: contain;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 毛玻璃效果面板 */
.glass-panel {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 10px var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.2s ease;
    will-change: transform;
    transform: translateZ(0);
}

.glass-panel:hover {
    transform: translateY(-2px);
}

header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 30px;
    position: relative;
}

header h1 {
    font-weight: 600;
    font-size: 2.2rem;
    background: linear-gradient(135deg, var(--accent), #a286ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.theme-toggle {
    position: absolute;
    right: 0;
    top: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--card-bg);
    box-shadow: 0 2px 10px var(--shadow);
    transition: all 0.2s;
}

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

.theme-toggle svg {
    width: 24px;
    height: 24px;
    color: var(--text);
}

.icon-sun {
    display: none;
}

.dark-theme .icon-moon {
    display: none;
}

.dark-theme .icon-sun {
    display: block;
}

/* 搜索区域 */
.search-section {
    padding: 24px;
    margin-bottom: 30px;
}

.search-container {
    width: 100%;
}

.search-title {
    font-size: 1.4rem;
    margin-bottom: 16px;
    color: var(--accent);
    text-align: center;
}

.search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.search-box {
    display: flex;
    flex-direction: column;
}

.search-engine-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    margin-bottom: 10px;
    padding-left: 4px;
}

.search-engine-label span {
    color: var(--text);
    margin-left: 8px;
    font-size: 1rem;
}

.search-engine-logo {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
}

.search-engine-logo svg {
    width: 100%;
    height: 100%;
}

.google-logo {
    background: #ffffff;
}

.baidu-logo {
    background: #2932E1;
}

.bing-logo {
    background: #ffffff;
}

.search-form {
    display: flex;
    position: relative;
    width: 100%;
}

.search-form input {
    flex: 1;
    padding: 12px 40px 12px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text);
    font-size: 1rem;
    transition: all 0.2s;
    width: 100%;
}

.search-form input::placeholder {
    color: var(--text);
    opacity: 0.6;
}

.search-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(87, 102, 242, 0.2);
}

.search-form button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: all 0.2s;
}

.search-form button:hover {
    background-color: rgba(87, 102, 242, 0.1);
}

.search-form button svg {
    width: 20px;
    height: 20px;
}

/* 链接区域 */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    contain: content;
    content-visibility: auto;
    contain-intrinsic-size: 300px;
}

.category {
    padding: 20px;
    height: 100%;
    contain: layout style paint;
    transform: translateZ(0);
}

.category-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.category-icon {
    width: 32px;
    height: 32px;
    margin-right: 12px;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background-color: rgba(87, 102, 242, 0.1);
    padding: 6px;
}

.category-icon svg {
    width: 100%;
    height: 100%;
}

.category-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.links-list {
    list-style: none;
}

.link-item {
    margin-bottom: 10px;
    contain: layout style;
    transform: translateZ(0);
}

.link-item a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text);
    padding: 8px 12px;
    padding-left: 16px;
    border-radius: var(--radius-sm);
    transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
    will-change: transform, background-color;
}

.link-item a:hover {
    background-color: rgba(87, 102, 242, 0.1);
    color: var(--accent);
    transform: translateX(5px);
}

.link-icon {
    display: none;
}

.link-text-container {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.link-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-desc {
    font-size: 0.85rem;
    margin-top: 3px;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 底部 */
footer {
    text-align: center;
    padding: 20px;
    font-size: 0.9rem;
    margin-top: 50px;
}

footer a {
    color: var(--accent);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .links-grid {
        grid-template-columns: 1fr;
    }
    
    .search-grid {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .search-box {
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .search-form input {
        padding: 10px 35px 10px 10px;
        font-size: 0.9rem;
    }
    
    .search-form button {
        width: 30px;
        height: 30px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .category {
        padding: 15px;
    }
}

/* 性能优化规则 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .glass-panel:hover {
        transform: none;
    }
    
    .link-item a:hover {
        transform: none;
    }
}

.centered-title {
    text-align: center;
    width: 100%;
    margin: 0 auto;
}

/* 性能优化 - 减少重排和重绘 */
html {
    scroll-behavior: smooth;
} 