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

/* 通用 SVG 图标样式 */
svg.icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    fill: currentColor;
    overflow: hidden;
    color: inherit;
}

svg.icon use {
    fill: inherit;
}

:root {
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --bg-body: #f3f4f6;
    --bg-card: rgba(255, 255, 255, 0.8);
    --text-color: #374151;
    --text-secondary: #6b7280;
    --radius: 20px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.15);
}

body[data-theme="purple"] {
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --bg-body: #f3f4f6;
    --bg-card: rgba(255, 255, 255, 0.8);
    --text-color: #374151;
    --text-secondary: #6b7280;
}

body[data-theme="pink"] {
    --primary-gradient: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
    --primary-color: #ec4899;
    --secondary-color: #f43f5e;
    --bg-body: #fdf2f8;
    --bg-card: rgba(255, 255, 255, 0.85);
    --text-color: #374151;
    --text-secondary: #6b7280;
}

body[data-theme="blue"] {
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    --primary-color: #3b82f6;
    --secondary-color: #06b6d4;
    --bg-body: #eff6ff;
    --bg-card: rgba(255, 255, 255, 0.8);
    --text-color: #374151;
    --text-secondary: #6b7280;
}

body[data-theme="green"] {
    --primary-gradient: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --primary-color: #10b981;
    --secondary-color: #34d399;
    --bg-body: #f0fdf4;
    --bg-card: rgba(255, 255, 255, 0.8);
    --text-color: #374151;
    --text-secondary: #6b7280;
}

body[data-theme="dark"] {
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --primary-color: #818cf8;
    --secondary-color: #a78bfa;
    --bg-body: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.9);
    --text-color: #e2e8f0;
    --text-secondary: #94a3b8;
}

body {
    background: var(--bg-body);
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Microsoft YaHei", sans-serif;
    color: var(--text-color);
    transition: background 0.3s ease;
    padding-top: 80px;
}

/* 毛玻璃导航栏 */
.glass-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-menu {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
}

.nav-menu-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 8px;
}

.nav-menu-item {
    display: flex;
}

.nav-menu-item a {
    padding: 8px 16px;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.nav-menu-item a:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.nav-logo {
    height: 40px;
    width: 40px;
    border-radius: 12px;
    object-fit: cover;
}

.nav-title {
    font-size: 20px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-theme-switcher {
    display: flex;
    gap: 8px;
}

.nav-theme-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-theme-btn[data-theme="purple"] {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

.nav-theme-btn[data-theme="pink"] {
    background: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
}

.nav-theme-btn[data-theme="blue"] {
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
}

.nav-theme-btn[data-theme="green"] {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
}

.nav-theme-btn[data-theme="dark"] {
    background: linear-gradient(135deg, #0f172a 0%, #818cf8 100%);
}

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

.nav-theme-btn.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* 主容器 */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* 欢迎卡片 */
.welcome-section {
    margin-bottom: 24px;
}

.welcome-card {
    background: var(--primary-gradient);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.welcome-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.welcome-title {
    position: relative;
    z-index: 1;
    font-size: 36px;
    font-weight: 700;
    color: white;
    margin-bottom: 12px;
}

.welcome-subtitle {
    position: relative;
    z-index: 1;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
}

/* 搜索框 */
.search-section {
    margin-bottom: 24px;
}

.search-box {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    gap: 12px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.search-input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid transparent;
    border-radius: 14px;
    font-size: 16px;
    outline: none;
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-color);
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-btn {
    padding: 14px 24px;
    background: var(--primary-gradient);
    border: none;
    border-radius: 14px;
    color: white;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* 分组标签 */
.groups-section {
    margin-bottom: 24px;
}

.groups-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
}

.groups-scroll::-webkit-scrollbar {
    height: 6px;
}

.groups-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.groups-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.group-tab {
    padding: 10px 20px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.group-tab:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.9);
}

.group-tab.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* 链接卡片 */
.links-section {
    margin-bottom: 32px;
}

.links-grid {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.group-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.group-wrapper[style*="display: none"] + .group-wrapper {
    margin-top: 0;
}

.group-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color);
    padding: 0 4px;
}

.group-title span:first-child {
    font-size: 24px;
}

.link-cards-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.link-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    cursor: pointer;
}

.link-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.link-icon-wrapper {
    flex-shrink: 0;
}

.link-icon {
    width: 52px;
    height: 52px;
    background: var(--primary-gradient);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    overflow: hidden;
}

.link-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
}

.link-icon svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
    color: inherit;
}

.link-icon:has(img) {
    background: transparent;
    padding: 0;
}

.link-icon:has(svg) {
    background: transparent;
    padding: 0;
}

.link-icon svg use {
    fill: inherit;
}

/* 确保文章图片能正常显示 */
.link-icon img {
    display: block !important;
    visibility: visible !important;
}

.link-content {
    flex: 1;
    min-width: 0;
}

.link-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 4px;
}

.link-url {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-actions {
    flex-shrink: 0;
}

.link-btn {
    padding: 8px 16px;
    background: var(--primary-gradient);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.link-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* 底部版权 */
.footer-section {
    margin-top: 32px;
}

.footer-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.footer-card p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* 响应式 */
@media (max-width: 768px) {
    body {
        padding-top: 70px;
    }
    
    .nav-container {
        padding: 12px 16px;
    }
    
    .nav-title {
        font-size: 16px;
    }
    
    .nav-logo {
        height: 32px;
        width: 32px;
        border-radius: 10px;
    }
    
    .nav-theme-btn {
        width: 28px;
        height: 28px;
    }
    
    .nav-menu {
        display: none;
    }
    
    .main-container {
        padding: 16px;
    }
    
    .welcome-card {
        padding: 28px 20px;
    }
    
    .welcome-title {
        font-size: 28px;
    }
    
    .welcome-subtitle {
        font-size: 14px;
    }
    
    .links-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .link-card {
        padding: 16px;
    }
    
    .link-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
}

/* 动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-card,
.search-box,
.link-card {
    animation: fadeInUp 0.6s ease forwards;
}

.search-box {
    animation-delay: 0.1s;
}

.link-card:nth-child(1) { animation-delay: 0.2s; }
.link-card:nth-child(2) { animation-delay: 0.3s; }
.link-card:nth-child(3) { animation-delay: 0.4s; }
.link-card:nth-child(4) { animation-delay: 0.5s; }
.link-card:nth-child(5) { animation-delay: 0.6s; }
