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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

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

header {
    background-color: #343a40;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}

.toolbar button {
    background-color: #495057;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.toolbar button:hover {
    background-color: #6c757d;
}

main {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px 0;
}

.editor-container, .preview-container {
    flex: 1;
    min-width: 300px;
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.editor-header, .preview-header {
    background-color: #e9ecef;
    padding: 10px 15px;
    border-bottom: 1px solid #dee2e6;
}

.editor-header h2, .preview-header h2 {
    font-size: 1.2rem;
    color: #495057;
}

#markdown-input {
    width: 100%;
    height: 500px;
    padding: 15px;
    border: none;
    resize: none;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 14px;
    line-height: 1.5;
}

#markdown-input:focus {
    outline: none;
}

#preview-output {
    padding: 15px;
    height: 500px;
    overflow-y: auto;
}

/* Markdown 预览样式 */
#preview-output h1, 
#preview-output h2, 
#preview-output h3, 
#preview-output h4, 
#preview-output h5, 
#preview-output h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.25;
}

#preview-output h1 {
    font-size: 2em;
    border-bottom: 1px solid #eaecef;
    padding-bottom: 0.3em;
}

#preview-output h2 {
    font-size: 1.5em;
    border-bottom: 1px solid #eaecef;
    padding-bottom: 0.3em;
}

#preview-output h3 {
    font-size: 1.25em;
}

#preview-output h4 {
    font-size: 1em;
}

#preview-output p {
    margin-bottom: 1rem;
}

#preview-output ul, 
#preview-output ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

#preview-output blockquote {
    padding: 0 1rem;
    margin-bottom: 1rem;
    color: #6a737d;
    border-left: 0.25rem solid #dfe2e5;
}

#preview-output pre {
    background-color: #f6f8fa;
    border-radius: 3px;
    padding: 16px;
    overflow: auto;
    margin-bottom: 1rem;
}

#preview-output code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    background-color: rgba(27, 31, 35, 0.05);
    border-radius: 3px;
    padding: 0.2em 0.4em;
    font-size: 85%;
}

#preview-output pre code {
    background-color: transparent;
    padding: 0;
}

#preview-output table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1rem;
}

#preview-output table th,
#preview-output table td {
    padding: 6px 13px;
    border: 1px solid #dfe2e5;
}

#preview-output table tr {
    background-color: #fff;
    border-top: 1px solid #c6cbd1;
}

#preview-output table tr:nth-child(2n) {
    background-color: #f6f8fa;
}

#preview-output img {
    max-width: 100%;
}

#preview-output hr {
    height: 0.25em;
    padding: 0;
    margin: 24px 0;
    background-color: #e1e4e8;
    border: 0;
}

footer {
    background-color: #343a40;
    color: #adb5bd;
    padding: 1rem 0;
    text-align: center;
    margin-top: 2rem;
}

@media (max-width: 768px) {
    main {
        flex-direction: column;
    }
    
    .editor-container, .preview-container {
        width: 100%;
    }
    
    #markdown-input, #preview-output {
        height: 300px;
    }
}