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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(145deg, #fbe9e7 0%, #ffccbc 100%);
    min-height: 100vh;
    padding: 20px;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 25px;
}

h1 {
    color: #bf360c;
    font-size: 2.5rem;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.05);
    font-weight: 600;
    letter-spacing: -0.5px;
}

.subtitle {
    color: #d84315;
    font-size: 1.1rem;
    font-weight: 400;
}

.editor-preview {
    display: flex;
    gap: 25px;
    flex: 1;
    min-height: 0;
}

.panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fffaf0;
    border-radius: 24px;
    box-shadow: 0 20px 35px -8px rgba(191, 54, 12, 0.2), 0 5px 10px -4px rgba(0,0,0,0.05);
    overflow: hidden;
    border: 1px solid #ffe0b2;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(to right, #ffecb3, #ffe0b2);
    border-bottom: 2px solid #ffb74d;
}

.badge {
    background: #e65100;
    color: white;
    padding: 6px 16px;
    border-radius: 40px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 2px 8px rgba(230, 81, 0, 0.3);
}

.icon-btn {
    background: rgba(255,255,255,0.6);
    border: 1px solid #ffb74d;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 30px;
    transition: all 0.2s ease;
    color: #bf360c;
    margin-left: 8px;
}

.icon-btn:hover {
    background: #ffb74d;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(230, 81, 0, 0.2);
    border-color: #e65100;
}

#markdownInput {
    flex: 1;
    padding: 24px;
    border: none;
    outline: none;
    resize: none;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 15px;
    line-height: 1.6;
    background: #fff5e6;
    color: #3e2723;
}

#markdownInput::placeholder {
    color: #a1887f;
    opacity: 0.6;
}

.preview-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: #fffaf0;
    color: #3e2723;
    line-height: 1.7;
}

/* Markdown rendered styles - warm theme */
.preview-content h1,
.preview-content h2,
.preview-content h3,
.preview-content h4 {
    color: #bf360c;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.preview-content h1 { 
    font-size: 2.2em; 
    border-bottom: 3px solid #ffb74d; 
    padding-bottom: 0.2em; 
}
.preview-content h2 { 
    font-size: 1.8em; 
    border-bottom: 2px solid #ffcc80; 
    padding-bottom: 0.2em; 
}
.preview-content h3 { font-size: 1.4em; color: #d84315; }

.preview-content p {
    margin-bottom: 1.2em;
}

.preview-content a {
    color: #e65100;
    text-decoration: none;
    border-bottom: 1px dashed #ffb74d;
}

.preview-content a:hover {
    color: #bf360c;
    border-bottom: 2px solid #e65100;
}

.preview-content code {
    background: #ffecb3;
    padding: 3px 8px;
    border-radius: 12px;
    font-family: 'SF Mono', 'Monaco', monospace;
    font-size: 0.9em;
    color: #4e342e;
    border: 1px solid #ffe082;
}

.preview-content pre {
    background: #2d2d2d; /* keep dark for code readability but with warm accent */
    padding: 20px;
    border-radius: 18px;
    overflow-x: auto;
    margin: 1.2em 0;
    border-left: 5px solid #ff8a65;
    box-shadow: inset 0 0 0 1px #4e342e;
}

.preview-content pre code {
    background: none;
    padding: 0;
    border: none;
    color: #f8f8f2;
    font-size: 0.95em;
}

.preview-content blockquote {
    margin: 1.2em 0;
    padding: 0.8em 1.5em;
    border-left: 6px solid #ff8a65;
    background: #fff3e0;
    border-radius: 0 16px 16px 0;
    color: #4e342e;
    font-style: italic;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.preview-content ul,
.preview-content ol {
    margin: 0.8em 0 1.2em 1.8em;
}

.preview-content li {
    margin-bottom: 0.4em;
}

.preview-content table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    margin: 1.2em 0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 6px 12px rgba(191, 54, 12, 0.08);
}

.preview-content th,
.preview-content td {
    border: 1px solid #ffe0b2;
    padding: 12px 16px;
    text-align: left;
}

.preview-content th {
    background: #ffb74d;
    color: #3e2723;
    font-weight: 600;
    border-bottom: 2px solid #e65100;
}

.preview-content tr:nth-child(even) {
    background: #fff8e1;
}

.preview-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.error {
    color: #c62828;
    font-style: italic;
    background: #ffebee;
    padding: 12px 20px;
    border-radius: 30px;
    border-left: 5px solid #b71c1c;
}

footer.info {
    text-align: center;
    margin-top: 20px;
    color: #bf360c;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    .editor-preview {
        flex-direction: column;
    }
    .app-container {
        height: auto;
    }
    #markdownInput {
        min-height: 300px;
    }
    h1 {
        font-size: 2rem;
    }
}