/* 마크다운 에디터 */
:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --green: #16a34a;
  --green2: #15803d;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.07);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-family: 'Pretendard', 'Apple SD Gothic Neo', sans-serif; font-size: 14px; }

.wrap { max-width: 100%; padding: 0 0 60px; }

/* ── 헤더 ── */
.top { padding: 20px 0 16px; }
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 48px; height: 48px; flex-shrink: 0;
  background: linear-gradient(135deg, #16a34a, #0891b2);
  border-radius: 13px; display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
h1 { font-size: 22px; font-weight: 700; }
.sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── 툴바 ── */
.toolbar {
  display: flex; gap: 4px; flex-wrap: wrap; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px 10px 0 0;
  padding: 8px 10px; border-bottom: none;
}
.tb-btn {
  padding: 5px 9px; border-radius: 6px; border: 1px solid transparent;
  background: transparent; cursor: pointer; font-size: 13px; color: var(--muted);
  font-family: 'JetBrains Mono', monospace; transition: all .12s;
}
.tb-btn:hover { background: var(--bg); border-color: var(--line); color: var(--ink); }
.tb-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.tb-right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.view-btn {
  padding: 5px 12px; border-radius: 6px; border: 1px solid var(--line);
  background: transparent; cursor: pointer; font-size: 12px; color: var(--muted); transition: all .12s;
}
.view-btn.active { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }

/* ── 에디터 레이아웃 ── */
.editor-wrap {
  display: grid; grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line); border-radius: 0 0 10px 10px;
  overflow: hidden; background: var(--card); box-shadow: var(--shadow);
  min-height: 520px;
}
.editor-wrap.view-edit { grid-template-columns: 1fr 0; }
.editor-wrap.view-preview { grid-template-columns: 0 1fr; }

.pane-label {
  background: #f1f5f9; padding: 6px 14px; font-size: 11px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--line);
}

.editor-pane { display: flex; flex-direction: column; overflow: hidden; }
.editor-pane:first-child { border-right: 1px solid var(--line); }

textarea#mdInput {
  flex: 1; padding: 16px; border: none; outline: none; resize: none;
  font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 13px;
  line-height: 1.7; background: var(--card); color: var(--ink);
}

.preview-pane { display: flex; flex-direction: column; overflow: hidden; }
.preview-scroll {
  flex: 1; padding: 16px 20px; overflow-y: auto;
  font-size: 14px; line-height: 1.8; color: var(--ink);
}

/* ── Markdown 렌더 스타일 ── */
.preview-scroll h1 { font-size: 1.8em; border-bottom: 2px solid var(--line); padding-bottom: 8px; margin: 0 0 16px; }
.preview-scroll h2 { font-size: 1.4em; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin: 20px 0 12px; }
.preview-scroll h3 { font-size: 1.15em; margin: 18px 0 10px; }
.preview-scroll h4, .preview-scroll h5, .preview-scroll h6 { margin: 14px 0 8px; }
.preview-scroll p { margin: 0 0 12px; }
.preview-scroll ul, .preview-scroll ol { padding-left: 22px; margin: 0 0 12px; }
.preview-scroll li { margin-bottom: 4px; }
.preview-scroll blockquote { border-left: 4px solid var(--green); padding: 8px 16px; background: #f0fdf4; margin: 0 0 12px; color: #166534; border-radius: 0 8px 8px 0; }
.preview-scroll code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-family: monospace; font-size: 12px; }
.preview-scroll pre { background: #0f172a; color: #e2e8f0; padding: 14px 16px; border-radius: 8px; overflow-x: auto; margin: 0 0 14px; }
.preview-scroll pre code { background: none; padding: 0; color: inherit; font-size: 13px; }
.preview-scroll table { border-collapse: collapse; width: 100%; margin: 0 0 14px; }
.preview-scroll th, .preview-scroll td { border: 1px solid var(--line); padding: 7px 10px; }
.preview-scroll th { background: #f8fafc; font-weight: 700; }
.preview-scroll tr:nth-child(even) td { background: #f8fafc; }
.preview-scroll a { color: var(--green); text-decoration: underline; }
.preview-scroll img { max-width: 100%; border-radius: 6px; }
.preview-scroll hr { border: none; border-top: 2px solid var(--line); margin: 16px 0; }
.preview-scroll input[type="checkbox"] { margin-right: 6px; }

/* ── 상태 바 ── */
.status-bar {
  display: flex; gap: 14px; padding: 8px 14px; font-size: 11px; color: var(--muted);
  background: #f8fafc; border: 1px solid var(--line); border-top: none;
  border-radius: 0 0 10px 10px;
}

/* ── 버튼 ── */
.action-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn-act {
  padding: 8px 16px; border-radius: 8px; border: 1.5px solid var(--line);
  background: var(--card); cursor: pointer; font-size: 13px; font-weight: 600;
  color: var(--ink); transition: all .15s;
}
.btn-act:hover { border-color: var(--green); color: var(--green); }
.btn-act.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-act.primary:hover { background: var(--green2); border-color: var(--green2); }

/* ── 사용 안내 ── */
.guide-section {
  margin-top: 24px;
  background: rgba(246,248,255,.6);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.guide-section h2 { font-size: 15px; font-weight: 800; margin: 0 0 10px; color: var(--ink); }
.guide-section h2:not(:first-child) { margin-top: 18px; }
.guide-steps, .guide-features, .guide-usecase {
  margin: 0; padding-left: 18px;
  color: var(--muted); font-size: 13px; line-height: 1.8;
}
.guide-steps li, .guide-features li, .guide-usecase li { margin-bottom: 4px; }
.guide-steps strong, .guide-features strong { color: var(--ink); }
.guide-privacy {
  margin-top: 16px;
  background: #eff6ff; border: 1px solid rgba(37,99,235,.22);
  border-radius: 12px; padding: 12px 14px;
  font-size: 12px; color: #1e40af; line-height: 1.55;
}

@media (max-width: 680px) {
  .editor-wrap { grid-template-columns: 1fr; }
  .editor-pane:first-child { border-right: none; border-bottom: 1px solid var(--line); }
}
