/* Markdown to HTML — Neutral Dark */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #6366F1;
  --primary-dim: rgba(99,102,241,0.12);
  --bg: #0F1117;
  --bg-card: #1A1D27;
  --border: rgba(99,102,241,0.08);
  --text: #E2E8F0;
  --text-dim: #94A3B8;
  --text-muted: #475569;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --transition: 0.2s ease;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.6; }

.header { border-bottom: 1px solid var(--border); background: rgba(26,29,39,0.95); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 10; }
.header-inner { max-width: 1000px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; }
.header-left { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 1.2rem; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; background: var(--primary-dim); border-radius: var(--radius-sm); }
.header h1 { font-size: 1.05rem; font-weight: 700; }
.subtitle { font-size: 0.72rem; color: var(--text-dim); }

.main { max-width: 1000px; margin: 0 auto; padding: 20px; height: calc(100vh - 65px); }

.btn { padding: 8px 16px; font-family: var(--font); font-size: 0.78rem; font-weight: 600; border: none; border-radius: 6px; cursor: pointer; transition: all var(--transition); }
.btn-sm { padding: 5px 10px; font-size: 0.72rem; background: var(--primary-dim); color: var(--primary); border: 1px solid rgba(99,102,241,0.2); }

.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; height: 100%; }
.panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.panel-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

.tab-group { display: flex; gap: 2px; }
.tab { padding: 3px 8px; font-family: var(--font); font-size: 0.62rem; font-weight: 600; color: var(--text-muted); background: transparent; border: 1px solid transparent; border-radius: 4px; cursor: pointer; transition: all var(--transition); }
.tab.active { color: var(--primary); background: var(--primary-dim); border-color: rgba(99,102,241,0.15); }

.editor { flex: 1; padding: 12px; font-family: var(--mono); font-size: 0.72rem; color: var(--text); background: transparent; border: none; outline: none; resize: none; line-height: 1.7; }

.preview-area { flex: 1; padding: 14px; overflow-y: auto; font-size: 0.82rem; line-height: 1.7; }
.preview-area h1 { font-size: 1.5rem; margin: 0.5em 0 0.3em; }
.preview-area h2 { font-size: 1.2rem; margin: 0.5em 0 0.3em; }
.preview-area h3 { font-size: 1rem; margin: 0.4em 0 0.2em; }
.preview-area p { margin: 0.4em 0; }
.preview-area code { font-family: var(--mono); font-size: 0.72rem; background: rgba(99,102,241,0.08); padding: 2px 5px; border-radius: 3px; }
.preview-area pre { background: var(--bg); padding: 10px; border-radius: 6px; overflow-x: auto; margin: 0.5em 0; }
.preview-area pre code { background: transparent; padding: 0; }
.preview-area blockquote { border-left: 3px solid var(--primary); padding-left: 12px; color: var(--text-dim); margin: 0.5em 0; }
.preview-area ul, .preview-area ol { padding-left: 20px; margin: 0.4em 0; }
.preview-area a { color: var(--primary); }
.preview-area hr { border: none; border-top: 1px solid var(--border); margin: 0.8em 0; }
.preview-area img { max-width: 100%; border-radius: 6px; }
.preview-area table { width: 100%; border-collapse: collapse; margin: 0.5em 0; }
.preview-area th, .preview-area td { padding: 6px 10px; border: 1px solid var(--border); font-size: 0.72rem; }
.preview-area th { background: var(--bg); font-weight: 600; }

.source-area { flex: 1; padding: 12px; font-family: var(--mono); font-size: 0.62rem; color: var(--text-dim); overflow: auto; white-space: pre-wrap; margin: 0; }

.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 200; }
.toast { padding: 10px 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 4px 24px rgba(0,0,0,0.5); font-size: 0.82rem; animation: toastIn 0.3s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 700px) { .editor-grid { grid-template-columns: 1fr; height: auto; } .main { height: auto; } .panel { min-height: 300px; } }
