.md-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.md-panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  height: 520px;
}

.md-pane {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  overflow: hidden;
}

.md-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .75rem;
  background: var(--input-bg, #f9fafb);
  border-bottom: 1px solid var(--border, #e5e7eb);
  flex-shrink: 0;
}

.md-pane-title {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted, #6b7280);
}

.md-btn-sm {
  font-size: .75rem;
  padding: 3px 10px;
}

.md-out-tabs {
  display: flex;
  gap: 2px;
}

.md-out-tab {
  padding: 3px 12px;
  font-size: .75rem;
  font-weight: 600;
  border: none;
  background: none;
  color: var(--muted, #6b7280);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .12s, border-color .12s;
}
.md-out-tab:hover { color: #1e293b; }
.md-out-tab.active { color: #2563eb; border-bottom-color: #2563eb; }

.md-textarea {
  flex: 1;
  width: 100%;
  padding: .75rem;
  font-family: ui-monospace, monospace;
  font-size: .8125rem;
  border: none;
  background: #fff;
  color: var(--text, #111);
  resize: none;
  box-sizing: border-box;
  line-height: 1.65;
  outline: none;
}

.md-textarea--html {
  background: var(--input-bg, #f9fafb);
}

.md-textarea.hidden,
.md-preview.hidden { display: none; }

/* Preview prose styles */
.md-preview {
  flex: 1;
  overflow-y: auto;
  padding: .75rem 1rem;
  background: #fff;
  box-sizing: border-box;
}

.md-prose h1,
.md-prose h2,
.md-prose h3,
.md-prose h4,
.md-prose h5,
.md-prose h6 {
  font-weight: 700;
  line-height: 1.3;
  margin: 1.1em 0 .4em;
  color: #111;
}
.md-prose h1 { font-size: 1.6rem; border-bottom: 1px solid #e5e7eb; padding-bottom: .3em; }
.md-prose h2 { font-size: 1.25rem; border-bottom: 1px solid #e5e7eb; padding-bottom: .25em; }
.md-prose h3 { font-size: 1.05rem; }
.md-prose h4 { font-size: .95rem; }

.md-prose p { margin: .6em 0; line-height: 1.7; }

.md-prose strong { font-weight: 700; }
.md-prose em { font-style: italic; }
.md-prose del { text-decoration: line-through; color: var(--muted, #6b7280); }

.md-prose code {
  font-family: ui-monospace, monospace;
  font-size: .85em;
  background: #f3f4f6;
  padding: .1em .35em;
  border-radius: 4px;
  color: #1d4ed8;
}

.md-prose pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: .9rem 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: .75em 0;
}
.md-prose pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: .8125rem;
}

.md-prose blockquote {
  border-left: 3px solid #2563eb;
  margin: .75em 0;
  padding: .3em .85em;
  background: #eff6ff;
  border-radius: 0 4px 4px 0;
  color: #374151;
}
.md-prose blockquote p { margin: .25em 0; }

.md-prose ul,
.md-prose ol {
  margin: .5em 0;
  padding-left: 1.5em;
}
.md-prose li { margin: .2em 0; line-height: 1.6; }

.md-prose hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 1.2em 0;
}

.md-prose a { color: #2563eb; text-decoration: underline; }
.md-prose a:hover { color: #1d4ed8; }

.md-prose img { max-width: 100%; border-radius: 4px; }

.md-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: .75em 0;
  font-size: .875rem;
}
.md-prose th,
.md-prose td {
  border: 1px solid #e5e7eb;
  padding: .4em .75em;
  text-align: left;
}
.md-prose th {
  background: #f9fafb;
  font-weight: 700;
}
.md-prose tr:nth-child(even) td { background: #fafafa; }

@media (max-width: 700px) {
  .md-panes {
    grid-template-columns: 1fr;
    height: auto;
  }
  .md-pane { height: 320px; }
}
