:root {
    --primary: #4F6EF7;
    --primary-hover: #3B5DE7;
    --primary-light: rgba(79, 110, 247, 0.1);
    --primary-bg: rgba(79, 110, 247, 0.04);
    --bg: #f1f4f8;
    --surface: #ffffff;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 4px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 40px -10px rgba(0, 0, 0, 0.1), 0 8px 16px -8px rgba(0, 0, 0, 0.05);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --sidebar-width: 200px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 24px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.sidebar-header h1 span {
    color: var(--primary);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
    position: relative;
}

.sidebar a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
    transition: height var(--transition);
}

.sidebar a:hover {
    background: var(--primary-bg);
    color: var(--text);
}

.sidebar a.active {
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 600;
}

.sidebar a.active::before {
    height: 20px;
}

.sidebar a .nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.3;
    flex-shrink: 0;
    transition: all var(--transition);
}

.sidebar a.active .nav-dot,
.sidebar a:hover .nav-dot {
    opacity: 1;
}

.content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 32px 40px 60px;
    max-width: 1100px;
}

.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 28px 32px 32px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: box-shadow var(--transition), transform var(--transition);
    margin-bottom: 24px;
}

.card:last-child {
    margin-bottom: 0;
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}

.card-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: var(--primary);
    border-radius: 2px;
    flex-shrink: 0;
}

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

.link-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    padding: 12px 6px 10px;
    border-radius: var(--radius);
    transition: all var(--transition);
    position: relative;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.link-item:hover {
    background: var(--primary-bg);
    transform: translateY(-1px);
}

.link-item:active {
    transform: scale(0.96);
}

.link-item .link-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f2ff 0%, #e8ecff 100%);
    border-radius: 14px;
    margin-bottom: 8px;
    transition: all var(--transition);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.link-item:hover .link-icon {
    background: linear-gradient(135deg, #e0e5ff 0%, #d4dbff 100%);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(79, 110, 247, 0.15);
}

.link-item .link-icon img {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: contain;
    position: relative;
    z-index: 1;
}

.link-item .link-icon .fallback-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    position: absolute;
    inset: 0;
}

.link-item span {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-all;
    transition: color var(--transition);
}

.link-item:hover span {
    color: var(--text);
}

@media (max-width: 1024px) {
    .content {
        padding: 24px 28px 48px;
    }

    .card {
        padding: 24px 24px 28px;
    }
}

@media (max-width: 768px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: sticky;
        top: 0;
        flex-direction: column;
        border-right: none;
        border-bottom: 1px solid var(--border);
        backdrop-filter: blur(12px);
        background: rgba(255, 255, 255, 0.92);
    }

    .sidebar-header {
        padding: 16px 20px 0;
        border-bottom: none;
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 8px 12px 12px;
        gap: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-nav::-webkit-scrollbar {
        display: none;
    }

    .sidebar a {
        white-space: nowrap;
        padding: 8px 14px;
        font-size: 0.85rem;
        border-radius: 20px;
        flex-shrink: 0;
    }

    .sidebar a::before {
        display: none;
    }

    .sidebar a.active {
        background: var(--primary);
        color: #fff;
    }

    .sidebar a .nav-dot {
        display: none;
    }

    .content {
        margin-left: 0;
        padding: 20px 16px 40px;
    }

    .card {
        padding: 20px 16px 24px;
        border-radius: var(--radius);
        margin-bottom: 16px;
    }

    .card-title {
        font-size: 1.05rem;
        margin-bottom: 14px;
        padding-bottom: 10px;
    }

    .links {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 4px;
    }

    .link-item {
        padding: 10px 4px 8px;
        border-radius: var(--radius-sm);
    }

    .link-item .link-icon {
        width: 42px;
        height: 42px;
        border-radius: 12px;
    }

    .link-item .link-icon img {
        width: 24px;
        height: 24px;
    }

    .link-item span {
        font-size: 0.75rem;
    }
}
