* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
    color: #333;
    transition: background-image 0.5s ease, background-color 0.3s ease, color 0.3s ease;
}

/* 主题切换按钮 */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.theme-icon {
    display: block;
    transition: transform 0.3s ease;
}

.theme-toggle:hover .theme-icon {
    transform: rotate(15deg);
}

/* 暗色模式 */
body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e0e0e0;
    position: relative;
}

/* 暗色模式下如果有背景图片，添加遮罩层 */
body.dark-mode.has-background-image::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    pointer-events: none;
}

body.dark-mode .theme-toggle {
    background: rgba(0, 0, 0, 0.3);
    color: #ffd700;
}

body.dark-mode .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.5);
}

body.dark-mode header {
    color: #ffffff;
}

body.dark-mode .loading {
    color: #e0e0e0;
}

body.dark-mode .category {
    background: #2a2a3e;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    color: #e0e0e0;
}

body.dark-mode .category:hover {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
}

body.dark-mode .category-header {
    border-bottom-color: #3a3a4e;
}

body.dark-mode .category-header:hover {
    opacity: 0.9;
}

body.dark-mode .category-toggle-icon {
    color: #aaa;
}

body.dark-mode .category-title {
    color: #ffffff;
}

body.dark-mode .link {
    background: #1e1e2e;
    color: #e0e0e0;
    border-color: #3a3a4e;
}

body.dark-mode .link:hover {
    background: #4a5568;
    color: #ffffff;
    border-color: #4a5568;
}

body.dark-mode .link-description {
    opacity: 0.8;
}

body.dark-mode .empty-state {
    color: #e0e0e0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 40px 20px;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.loading {
    text-align: center;
    color: white;
    font-size: 1.2rem;
    padding: 40px;
}

.content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

.category {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.category:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
    position: relative;
}

.category-header:hover {
    opacity: 0.8;
}

.category-header:active {
    opacity: 0.6;
}

.category-header-content {
    display: flex;
    align-items: center;
    flex: 1;
}

.category-toggle-icon {
    font-size: 0.9rem;
    color: #999;
    transition: transform 0.3s ease;
    margin-left: 10px;
}

.category.collapsed .category-toggle-icon {
    transform: rotate(-90deg);
}

.category-content {
    max-height: 5000px;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, margin-bottom 0.3s ease;
    opacity: 1;
    margin-bottom: 0;
}

.category.collapsed .category-content {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.category-icon {
    font-size: 2rem;
    margin-right: 12px;
}

.category-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.links-list {
    list-style: none;
}

.link-item {
    margin-bottom: 12px;
}

.link-item:last-child {
    margin-bottom: 0;
}

.link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.link:hover {
    background: #667eea;
    color: white;
    transform: translateX(5px);
    border-color: #667eea;
}

.link-icon {
    width: 24px;
    height: 24px;
    margin-right: 12px;
    border-radius: 4px;
    object-fit: cover;
}

.link-content {
    flex: 1;
}

.link-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.link-description {
    font-size: 0.85rem;
    opacity: 0.7;
}

.link:hover .link-description {
    opacity: 0.9;
}

.empty-state {
    text-align: center;
    color: white;
    padding: 60px 20px;
    font-size: 1.2rem;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .theme-toggle {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
}
