:root {
    --primary-color: #1a202c;
    --secondary-color: #3182ce;
    --accent-color: #38b2ac;
    --bg-color: #f7fafc;
    --card-bg: #ffffff;
    --text-color: #2d3748;
    --text-secondary: #4a5568;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --sidebar-width: 280px;
    --header-height: 70px;
    --radius: 8px;
}

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

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #2d3748 100%);
    height: var(--header-height);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-lg);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

header h1 {
    font-size: 1.5rem;
    color: white;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #2b6cb0 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.main-layout {
    display: flex;
    margin-top: calc(var(--header-height) + 30px);
    gap: 30px;
    padding-bottom: 40px;
}

.sidebar {
    width: var(--sidebar-width);
    position: sticky;
    top: calc(var(--header-height) + 30px);
    height: calc(100vh - var(--header-height) - 60px);
    overflow-y: auto;
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.sidebar nav ul {
    list-style: none;
}

.sidebar nav li {
    margin-bottom: 8px;
}

.sidebar nav a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: block;
    padding: 8px 12px;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.sidebar nav a:hover, .sidebar nav a.active {
    background-color: #ebf8ff;
    color: var(--secondary-color);
    font-weight: 500;
}

/* ========== 顶级导航样式 ========== */
.top-nav-container {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.top-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.top-nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    display: block;
    padding: 12px 16px;
    border-radius: var(--radius);
    background: linear-gradient(to right, #f7fafc 0%, #edf2f7 100%);
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
    position: relative;
}

.top-nav-link:hover {
    background: linear-gradient(to right, #ebf8ff 0%, #e6fffa 100%);
    color: var(--secondary-color);
    border-left-color: var(--secondary-color);
}

.top-nav-link.active {
    background: linear-gradient(to right, var(--secondary-color) 0%, #2b6cb0 100%);
    color: white !important;
    border-left-color: var(--accent-color);
    box-shadow: var(--shadow);
}

/* ========== 子分类导航样式 ========== */
.sub-nav-container {
    margin-top: 12px;
}

.sub-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sub-nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: block;
    padding: 8px 12px;
    padding-left: 24px;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    border-left: 3px solid var(--border-color);
}

.sub-nav-link:hover {
    background-color: #f7fafc;
    color: var(--secondary-color);
    border-left-color: var(--secondary-color);
}

.sub-nav-link.active {
    background: linear-gradient(to right, var(--secondary-color) 0%, #2b6cb0 100%);
    color: white !important;
    border-left-color: var(--accent-color);
    font-weight: 600;
}

/* ========== 空消息样式 ========== */
.empty-message {
    color: var(--text-secondary);
    text-align: center;
    padding: 60px 20px;
    font-size: 1.1rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

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

.category-section {
    margin-bottom: 40px;
    scroll-margin-top: calc(var(--header-height) + 30px);
}

.category-title {
    font-size: 1.75rem;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--accent-color);
    color: var(--primary-color);
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* ========== 项目介绍样式 ========== */
section.category-section .category-intro {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 28px 32px;
    margin-bottom: 32px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.category-intro::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--accent-color) 0%, var(--secondary-color) 100%);
}

.category-intro h1,
.category-intro h2,
.category-intro h3,
.category-intro h4 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 16px;
    font-weight: 600;
}

.category-intro h1 {
    font-size: 1.5rem;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 8px;
    display: inline-block;
}

.category-intro h2 {
    font-size: 1.3rem;
}

.category-intro h3 {
    font-size: 1.1rem;
}

.category-intro p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 16px;
    font-size: 1rem;
}

.category-intro ul,
.category-intro ol {
    padding-left: 24px;
    margin: 16px 0;
}

.category-intro li {
    margin-bottom: 8px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.category-intro strong {
    color: var(--primary-color);
    font-weight: 600;
}

.category-intro code {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.9em;
    color: var(--secondary-color);
}

.category-intro pre {
    background: #2d3748;
    color: #e2e8f0;
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 16px 0;
}

.category-intro blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 20px;
    margin: 20px 0;
    color: var(--text-secondary);
    font-style: italic;
    background: rgba(56, 178, 172, 0.05);
    padding: 16px 20px;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.category-intro blockquote p:last-child {
    margin-bottom: 0;
}

.script-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.script-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-color);
}

.script-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.script-path {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 1.05rem;
    color: var(--secondary-color);
    font-weight: 600;
    word-break: break-all;
    background: #ebf8ff;
    padding: 8px 12px;
    border-radius: var(--radius);
    flex: 1;
    margin-right: 16px;
}

.script-desc {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 1rem;
    line-height: 1.7;
}

.expand-btn {
    background: linear-gradient(135deg, var(--accent-color) 0%, #319795 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: var(--shadow);
}

.expand-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.script-details {
    display: none;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid var(--border-color);
    font-size: 0.95rem;
    line-height: 1.7;
    background: #f7fafc;
    margin: 0 -24px -24px -24px;
    padding: 24px;
    border-radius: 0 0 var(--radius) var(--radius);
}

.script-details.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

.script-details ul {
    padding-left: 24px;
    margin: 12px 0;
}

.script-details li {
    margin-bottom: 10px;
}

.script-details strong {
    color: var(--primary-color);
    font-weight: 600;
}

.script-details h1, .script-details h2, .script-details h3,
.script-details h4, .script-details h5, .script-details h6 {
    margin: 16px 0 12px 0;
    color: var(--primary-color);
}

.script-details code {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.9em;
}

.script-details pre {
    background: #2d3748;
    color: #e2e8f0;
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 16px 0;
}

.script-details pre code {
    background: none;
    padding: 0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
        gap: 20px;
    }
    
    .sidebar {
        width: 100%;
        position: static;
        height: auto;
        margin-bottom: 20px;
    }
    
    .container {
        padding: 0 16px;
    }
    
    .script-path {
        font-size: 0.9rem;
        padding: 6px 10px;
    }
}