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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

header h1 {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    font-size: 2.5em;
    font-weight: 800;
    letter-spacing: -0.02em;
}

header p {
    color: #64748b;
    font-size: 1.2em;
    margin-bottom: 20px;
    font-weight: 500;
}

/* 使用说明样式 */
.usage-guide {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 0;
    margin-top: 30px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.15);
    overflow: hidden;
    position: relative;
}

.usage-guide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    pointer-events: none;
}

.guide-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
    position: relative;
    z-index: 1;
}

.guide-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.4em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.guide-header .icon {
    font-size: 1.2em;
}

.guide-content {
    padding: 28px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
}

.guide-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.guide-row:last-child {
    margin-bottom: 0;
}

.guide-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.guide-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.card-header {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-icon {
    font-size: 1.1em;
    filter: grayscale(0.2);
}

.card-header h4 {
    margin: 0;
    color: #334155;
    font-size: 1.05em;
    font-weight: 600;
}

.card-content {
    padding: 20px;
}

.format-list, .requirement-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.format-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.format-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 24px;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
}

.format-badge.md {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.format-badge.txt {
    background: linear-gradient(135deg, #f093fb, #f5576c);
}

.requirement-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
}

.req-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 50%;
    font-size: 0.8em;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 2px;
}

.requirement-item code {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    color: #e74c3c;
    border: 1px solid #e2e8f0;
}

.color-guide {
    grid-column: 1;
}

.template-guide {
    grid-column: 2;
}

/* 颜色图例 */
.color-legend {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
}

.color-indicator {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid #e2e8f0;
    flex-shrink: 0;
}

.legend-text {
    color: #475569;
    font-size: 0.9em;
    line-height: 1.4;
}

.root-color {
    background: #ff6b6b;
}

.annotation-color {
    background: linear-gradient(45deg, #4ecdc4, #45b7d1, #96ceb4, #feca57);
}

.normal-color {
    background: #74b9ff;
}

.template-desc {
    color: #64748b;
    margin: 0 0 16px 0;
    font-size: 0.9em;
    line-height: 1.5;
}

.download-template-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    width: 100%;
    justify-content: center;
}

.download-template-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-icon {
    font-size: 1em;
}

/* 切换按钮 */
.toggle-guide {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.toggle-guide:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.usage-guide.collapsed .guide-content {
    display: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .guide-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .color-guide,
    .template-guide {
        grid-column: 1;
    }
    
    .guide-header {
        padding: 20px;
    }
    
    .guide-content {
        padding: 20px;
    }
    
    .file-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .reselect-btn, .generate-btn {
        width: 100%;
    }
}

.upload-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 35px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 30px;
}

.upload-area {
    border: 2px dashed #3498db;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: #2980b9;
    background-color: #f8f9fa;
}

.upload-area.dragover {
    border-color: #27ae60;
    background-color: #d5f4e6;
}

.upload-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.upload-area p {
    margin-bottom: 20px;
    color: #7f8c8d;
    font-size: 1.1em;
}

.upload-btn, .generate-btn, .control-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.upload-btn:hover, .generate-btn:hover, .control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
}

.generate-btn {
    background: linear-gradient(135deg, #27ae60, #219a52);
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.generate-btn:hover {
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.4);
}

.file-info {
    text-align: center;
    padding: 25px;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border-radius: 12px;
    margin-top: 20px;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.file-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 15px;
}

.reselect-btn {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(149, 165, 166, 0.3);
}

.reselect-btn:hover {
    background: linear-gradient(135deg, #7f8c8d, #95a5a6);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(149, 165, 166, 0.4);
}

.chart-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 35px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ecf0f1;
}

.chart-header h2 {
    color: #2c3e50;
    font-size: 1.5em;
}

.chart-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    background: #95a5a6;
    font-size: 0.9em;
    padding: 8px 16px;
}

.control-btn:hover {
    background: #7f8c8d;
}

.chart-container {
    background: #fafafa;
    border: 1px solid #ecf0f1;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    overflow-x: auto;
    text-align: center;
    min-height: 500px;
}

#mermaidChart {
    width: 100%;
    display: block;
}

#mermaidChart svg {
    width: 100%;
    height: auto;
    min-height: 400px;
}

.code-section {
    display: none;
}

.code-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2em;
}

#mermaidCode {
    width: 100%;
    height: 200px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f8f9fa;
    resize: vertical;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

.error {
    background: #e74c3c;
    color: white;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
}

.success {
    background: #27ae60;
    color: white;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
}

/* 全屏模式样式 */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.fullscreen-content {
    background: white;
    border-radius: 10px;
    padding: 20px;
    width: 90vw;
    height: 90vh;
    overflow: auto;
    position: relative;
    display: flex;
    flex-direction: column;
}

.fullscreen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ecf0f1;
}

.fullscreen-close {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
}

.fullscreen-close:hover {
    background: #c0392b;
}

.fullscreen-chart {
    flex: 1;
    text-align: center;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.fullscreen-chart svg {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .chart-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .chart-controls {
        justify-content: center;
    }
    
    .fullscreen-content {
        margin: 10px;
        width: calc(100vw - 20px);
        height: calc(100vh - 20px);
    }
    
    .fullscreen-header {
        flex-shrink: 0;
    }
} 