:root {
    --primary-color: #326ce5;
    --secondary-color: #54b4f0;
    --accent-color: #fd8c73;
    --text-color: #333;
    --light-gray: #f5f7fa;
    --border-color: #e1e4e8;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #fafafa;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

header {
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 15px;
}

header h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
}

nav ul {
    display: flex;
    list-style: none;
    overflow-x: auto;
    white-space: nowrap;
    flex-wrap: nowrap;
    padding-bottom: 5px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

nav ul li {
    margin-left: 1.5rem;
    display: inline-block;
    flex-shrink: 0;
}

nav ul li a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

nav ul li a:hover, nav ul li a.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

main {
    padding: 2rem 0;
}

section {
    margin-bottom: 3rem;
}

h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

h3 {
    color: var(--secondary-color);
    margin-bottom: 0.8rem;
    font-size: 1.4rem;
}

p {
    margin-bottom: 1rem;
}

ul, ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
}

.intro {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.diagram-container {
    margin: 20px 0;
    text-align: center;
    overflow-x: auto;
    max-width: 100%;
}

.diagram {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
}

.full-width-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.image-caption {
    text-align: center;
    margin-top: 10px;
    color: #666;
    font-style: italic;
}

.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.card {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.button {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.button:hover {
    background-color: #2857c7;
}

footer {
    background-color: var(--light-gray);
    padding: 2rem 0;
    text-align: center;
    margin-top: 3rem;
}

/* 实验页面样式 */
.experiment-card {
    background-color: white;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.experiment-card h3 {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.code-block {
    background-color: #f6f8fa;
    border-radius: 4px;
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    white-space: pre;
    line-height: 1.5;
    font-size: 0.9rem;
    border-left: 4px solid #ddd;
}

.code-block code {
    display: block;
}

/* 新增代码块类型样式 */
.code-block.command {
    background-color: #f5f5f5;
    border-left: 4px solid #007acc;
}

.code-block.output {
    background-color: #f9f9f9;
    border-left: 4px solid #4caf50;
    color: #444;
    font-style: italic;
}

/* 命令行提示符样式 */
.code-block.command .prompt {
    color: #888;
    user-select: none;
}

/* 代码高亮 */
.code-block .keyword {
    color: #0000ff;
    font-weight: bold;
}

.code-block .string {
    color: #a31515;
}

.code-block .comment {
    color: #008000;
    font-style: italic;
}

.code-block .path {
    color: #800080;
}

/* 安全显示HTML和特殊字符 */
.code-block .html-tag {
    color: #800000;
}

.code-block .html-attr {
    color: #ff0000;
}

.code-block .html-content {
    color: #000000;
}

.code-block .special-char {
    color: #808080;
    font-style: italic;
}

.code-block .shell-operator {
    color: #c71585;
    font-weight: bold;
}

.code-block .shell-var {
    color: #4682b4;
}

.step {
    margin-bottom: 1.5rem;
}

.step-number {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    width: 30px;
    height: 30px;
    text-align: center;
    line-height: 30px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

/* 新增样式 */
.diagram-caption {
    text-align: center;
    color: #666;
    font-style: italic;
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.feature {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

.feature:hover {
    transform: translateY(-5px);
}

.feature h3 {
    color: var(--primary-color);
    margin-bottom: 0.8rem;
}

.workflow-steps {
    margin: 2rem 0;
}

.step {
    display: flex;
    margin-bottom: 2rem;
    position: relative;
}

.step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 40px;
    left: 20px;
    height: calc(100% - 20px);
    width: 2px;
    background-color: var(--border-color);
}

.step-number {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1.5rem;
    font-weight: bold;
    font-size: 1.2rem;
    z-index: 1;
}

.step-content {
    flex-grow: 1;
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.info-box {
    background-color: #e7f5ff;
    border: 1px solid #74c0fc;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.info-box h3 {
    color: #1971c2;
    margin-top: 0;
}

.packet-flow {
    margin: 2rem 0;
    position: relative;
}

.packet-flow::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 15px;
    width: 2px;
    background-color: #dee2e6;
    z-index: 0;
}

.packet-flow .step {
    position: relative;
    padding-left: 50px;
    margin-bottom: 1.5rem;
    z-index: 1;
}

.packet-flow .number {
    position: absolute;
    left: 0;
    top: 0;
    width: 30px;
    height: 30px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.packet-flow .step p {
    background-color: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border-left: 3px solid var(--primary-color);
}

.note {
    background-color: #fff9db;
    border-left: 4px solid #fcc419;
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
}

.related-topics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.topic {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.topic h3 {
    color: var(--primary-color);
    margin-top: 0;
}

.topic p {
    flex-grow: 1;
    margin-bottom: 1rem;
}

.topic .button {
    align-self: flex-start;
}

.resources {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.resource {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    border-top: 4px solid var(--accent-color);
}

.resource h3 {
    color: var(--text-color);
    margin-top: 0;
}

.accordion {
    margin: 2rem 0;
}

.accordion-item {
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.accordion-header {
    padding: 1rem 1.5rem;
    background-color: var(--light-gray);
    cursor: pointer;
    font-weight: 500;
    position: relative;
    transition: background-color 0.3s ease;
}

.accordion-header::after {
    content: '+';
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    font-weight: bold;
}

.accordion-header.active {
    background-color: var(--primary-color);
    color: white;
}

.accordion-header.active::after {
    content: '−';
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 1.5rem;
}

.accordion-header.active + .accordion-content {
    max-height: 1000px;
    padding: 1.5rem;
}

.tips-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.tip {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-left: 4px solid var(--primary-color);
}

.tip h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.tip h4 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
}

/* 交互式组件样式 */
.interactive {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
    background-color: white;
}

.interactive-controls {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.tab-container {
    margin: 2rem 0;
}

.tabs {
    margin: 2rem 0;
    border-radius: 8px;
    overflow: hidden;
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.tab-headers {
    display: flex;
    background-color: var(--light-gray);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.tab-header {
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-header:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.tab-header.active {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
    background-color: white;
}

.tab-contents {
    padding: 1.5rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 案例研究样式 */
.case-studies {
    margin: 2rem 0;
}

.case-study {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-left: 4px solid var(--primary-color);
}

.case-study h3 {
    color: var(--primary-color);
    margin-top: 0;
}

.case-content {
    margin-top: 1rem;
}

.case-content h4 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

/* 比较表格样式 */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.comparison-table th, 
.comparison-table td {
    padding: 0.8rem;
    text-align: left;
    border: 1px solid var(--border-color);
}

.comparison-table th {
    background-color: var(--light-gray);
    font-weight: 600;
}

.comparison-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
    }
    
    nav ul {
        margin-top: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    nav ul li {
        margin: 0 0.5rem;
    }
    
    .card-container {
        grid-template-columns: 1fr;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
    
    .workflow-steps .step {
        flex-direction: column;
    }
    
    .workflow-steps .step-number {
        margin-bottom: 1rem;
    }
    
    .workflow-steps .step:not(:last-child)::after {
        display: none;
    }
    
    .tips-container {
        grid-template-columns: 1fr;
    }
    
    .tab-headers {
        flex-wrap: nowrap;
        overflow-x: auto;
    }
}
