.md-split-pane {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 400px;
}

.md-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.md-pane--editor {
  border-right: 1px solid var(--border);
}

#md-input {
  flex: 1;
  width: 100%;
  border: none;
  border-radius: 0;
  padding: 1rem;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.875rem;
  line-height: 1.7;
  resize: none;
  outline: none;
  background: #fafafa;
  color: var(--ink);
  min-height: 380px;
}

#md-input:focus {
  background: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.md-pane--preview {
  background: #fff;
}

.md-preview-header {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate);
  border-bottom: 1px solid var(--border);
  background: #f8f9fa;
}

.md-preview-content {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  min-height: 380px;
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--ink);
}

.md-preview-content h1 { font-size: 1.75rem; font-weight: 700; margin: 0 0 0.75rem; }
.md-preview-content h2 { font-size: 1.375rem; font-weight: 700; margin: 1.25rem 0 0.5rem; padding-bottom: 0.25rem; border-bottom: 1px solid var(--border); }
.md-preview-content h3 { font-size: 1.125rem; font-weight: 600; margin: 1rem 0 0.4rem; }
.md-preview-content h4 { font-size: 1rem; font-weight: 600; margin: 0.75rem 0 0.3rem; }
.md-preview-content p { margin: 0 0 0.75rem; }
.md-preview-content ul, .md-preview-content ol { margin: 0 0 0.75rem; padding-left: 1.5rem; }
.md-preview-content li { margin: 0.2rem 0; }
.md-preview-content a { color: var(--accent); text-decoration: underline; }
.md-preview-content blockquote {
  border-left: 4px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 0.75rem 0;
  background: var(--bg-subtle);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
}
.md-preview-content code {
  background: #eef1f6;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: #d63384;
}
.md-preview-content pre {
  background: #1e1e2e;
  color: #e0e0e0;
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 0 0 0.75rem;
}
.md-preview-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 0.85rem;
}
.md-preview-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}
.md-preview-content img { max-width: 100%; border-radius: var(--radius); }
.md-preview-content table { width: 100%; border-collapse: collapse; margin: 0 0 0.75rem; }
.md-preview-content th, .md-preview-content td { border: 1px solid var(--border); padding: 0.4rem 0.75rem; text-align: left; }
.md-preview-content th { background: var(--bg-subtle); font-weight: 600; }

.md-toolbar-btn svg {
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.tb-toolbar-spacer {
  flex: 1;
}

@media (max-width: 768px) {
  .md-split-pane {
    grid-template-columns: 1fr;
  }
  .md-pane--editor {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  #md-input {
    min-height: 200px;
  }
  .md-preview-content {
    min-height: 200px;
  }
  .tb-toolbar {
    flex-wrap: wrap;
  }
}

@media (prefers-color-scheme: dark) {
  .md-split-pane {
    background: var(--paper);
  }
  .md-pane {
    background: var(--paper);
  }
  .md-pane--preview {
    background: var(--moss-light);
  }
  .md-toolbar {
    background: var(--moss-light);
    border-color: var(--border);
  }
  .md-preview-content {
    background: var(--paper);
    color: var(--text);
  }
  .md-preview-content pre {
    background: #1e1e2e;
    color: #e0e0e0;
  }
  .md-preview-content code {
    background: var(--moss-light);
    color: var(--text);
  }
}
