/* 
 * 마크다운 ➔ HTML 변환기 — 프리미엄 스타일시트
 * 라이트/다크 테마 + 글래스모피즘 + 4대 맞춤형 뷰어 스타일셋 탑재
 */

:root {
  /* 라이트 테마 변수 (글래스 모던 퍼플) */
  --bg: #f3f4f6;
  --bg-workspace: #eceef2;
  --bg-elev: rgba(255, 255, 255, 0.75);
  --bg-input: #ffffff;
  --bg-source: #0b0f19;
  
  --fg: #1f2937;
  --fg-muted: #6b7280;
  --fg-strong: #111827;
  
  --border: rgba(209, 213, 219, 0.6);
  --border-strong: rgba(156, 163, 175, 0.8);
  
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-strong: #5b21b6;
  --accent-soft: rgba(124, 58, 237, 0.08);
  --accent-glow: rgba(124, 58, 237, 0.15);
  
  --secondary: #4f46e5;
  --secondary-hover: #4338ca;
  --secondary-soft: rgba(79, 70, 229, 0.08);
  
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-soft: rgba(239, 68, 68, 0.08);
  
  --code-bg: #0f172a;
  --code-fg: #f1f5f9;
  --quote-bg: rgba(124, 58, 237, 0.04);
  --quote-border: #8b5cf6;
  
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-elev: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --shadow-glow: 0 0 20px rgba(124, 58, 237, 0.1);
  
  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 9999px;
  
  --header-h: 70px;
  --footer-h: 44px;
  --divider-w: 12px;
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

:root[data-theme="dark"] {
  /* 다크 테마 변수 (글래스 옵시디언 코스모스) */
  --bg: #090d16;
  --bg-workspace: #060910;
  --bg-elev: rgba(17, 24, 39, 0.7);
  --bg-input: #0b0f19;
  --bg-source: #05070c;
  
  --fg: #d1d5db;
  --fg-muted: #9ca3af;
  --fg-strong: #f9fafb;
  
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.15);
  
  --accent: #a78bfa;
  --accent-hover: #c4b5fd;
  --accent-strong: #ddd6fe;
  --accent-soft: rgba(167, 139, 250, 0.12);
  --accent-glow: rgba(167, 139, 250, 0.25);
  
  --secondary: #818cf8;
  --secondary-hover: #a5b4fc;
  --secondary-soft: rgba(129, 140, 248, 0.12);
  
  --danger: #f87171;
  --danger-hover: #fca5a5;
  --danger-soft: rgba(248, 113, 113, 0.12);
  
  --code-bg: #030712;
  --code-fg: #f3f4f6;
  --quote-bg: rgba(167, 139, 250, 0.04);
  --quote-border: #6d28d9;
  
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-elev: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(167, 139, 250, 0.15);
}

/* ---------- 브라우저 리셋 및 글로벌 기본 설정 ---------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "Pretendard Variable", Pretendard, "Inter", -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  height: 100vh;
  letter-spacing: -0.01em;
  transition: background-color 0.3s, color 0.3s;
}

/* ---------- 스크롤바 커스텀 ---------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--fg-muted);
}

/* ---------- 공통 레이아웃 컴포넌트 ---------- */

/* 헤더 */
.app-header {
  height: var(--header-h);
  padding: 0 28px;
  background: var(--bg-elev);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  z-index: 10;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 4px 6px rgba(124, 58, 237, 0.2));
}

.brand-mark {
  width: 38px;
  height: 38px;
}

.brand-title {
  display: flex;
  flex-direction: column;
}

.brand-title h1 {
  font-family: 'Plus Jakarta Sans', "Pretendard Variable", sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: var(--fg-strong);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-badge {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------- 폼 요소 (인풋, 셀렉트) ---------- */
.custom-select-wrapper {
  position: relative;
  min-width: 170px;
}

.select-input {
  appearance: none;
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-strong);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 36px 8px 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: var(--transition-fast);
}

.select-input:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.select-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* 셀렉트 화살표 커스텀 */
.custom-select-wrapper::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 6px;
  background-color: var(--fg-muted);
  clip-path: polygon(100% 0, 0 0, 50% 100%);
  pointer-events: none;
}

.select-template {
  font-weight: 600;
  border-color: var(--border-strong);
  background-image: linear-gradient(var(--bg-input), var(--bg-input));
}

/* ---------- 버튼 스타일 ---------- */
.btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius);
  padding: 8px 16px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-ghost {
  background: var(--bg-elev);
  color: var(--fg-strong);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

.btn-ghost:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 4px 10px rgba(124, 58, 237, 0.2);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 6px 14px rgba(124, 58, 237, 0.35);
}

.btn-icon-only {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--fg-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: var(--transition-fast);
}

.btn-icon-only:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-icon-only:active {
  transform: scale(0.95);
}

.icon {
  width: 16px;
  height: 16px;
}

.theme-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon-only:hover .theme-icon-wrapper {
  transform: rotate(45deg);
}

/* ---------- 메인 워크스페이스 ---------- */
.workspace {
  flex: 1;
  display: flex;
  flex-direction: row;
  padding: 16px;
  background: var(--bg-workspace);
  gap: 0;
  min-height: 0;
  position: relative;
}

/* 패널(인풋/아웃풋) */
.pane {
  background: var(--bg-elev);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elev);
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  transition: box-shadow 0.3s;
}

.pane:hover {
  box-shadow: var(--shadow-elev), var(--shadow-glow);
}

/* 드래그 상태일 때 애니메이션 일시 차단 */
.workspace.is-dragging .pane {
  transition: none;
}

/* 입력 패널과 출력 패널 기본 크기 설정 */
.pane-input {
  width: calc(50% - 6px); /* 기본 절반 */
}

.pane-output {
  flex: 1; /* 나머지 채우기 */
}

/* 전체화면 모드 */
.pane.is-fullscreen {
  position: fixed !important;
  top: 16px !important;
  left: 16px !important;
  right: 16px !important;
  bottom: 16px !important;
  width: calc(100% - 32px) !important;
  height: calc(100% - 32px) !important;
  z-index: 100 !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
}

/* 패널 헤더 */
.pane-header {
  height: 52px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.pane-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pane-icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.pane-header h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--fg-strong);
  letter-spacing: -0.01em;
}

/* 전체화면 버튼 */
.btn-fullscreen {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  box-shadow: none;
  border-color: transparent;
  background: transparent;
  color: var(--fg-muted);
}

.btn-fullscreen:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- 에디터 영역 (좌) ---------- */
.editor-area {
  flex: 1;
  position: relative;
  min-height: 0;
}

#markdown-input {
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  resize: none;
  padding: 24px;
  background: var(--bg-input);
  color: var(--fg);
  font-family: "Fira Code", ui-monospace, "JetBrains Mono", "D2Coding", monospace;
  font-size: 14.5px;
  line-height: 1.7;
  tab-size: 2;
  transition: background-color 0.3s, color 0.3s;
}

#markdown-input:focus {
  /* 포커스 되었을 때 미세한 안개 글로우 */
  box-shadow: inset 0 0 10px var(--accent-glow);
}

#markdown-input::placeholder {
  color: var(--fg-muted);
  opacity: 0.6;
}

/* 에디터 하단 통계 바 */
.pane-footer-stats {
  height: 38px;
  padding: 0 20px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
  font-size: 11.5px;
  color: var(--fg-muted);
  font-weight: 500;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: help;
}

.stat-label {
  opacity: 0.7;
}

.stat-val {
  font-family: "Plus Jakarta Sans", "Inter", sans-serif;
  font-weight: 700;
  color: var(--fg-strong);
  font-variant-numeric: tabular-nums;
}

/* ---------- 분할 화면 디바이더 ---------- */
.split-divider {
  width: var(--divider-w);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: col-resize;
  position: relative;
  z-index: 5;
  flex-shrink: 0;
  user-select: none;
}

.split-divider-line {
  width: 2px;
  height: calc(100% - 32px);
  background: var(--border);
  border-radius: var(--radius-pill);
  transition: var(--transition-fast);
}

.split-divider-handle {
  width: 24px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  transition: var(--transition-fast);
  color: var(--fg-muted);
}

/* 디바이더 활성화 / 호버 상태 */
.split-divider:hover .split-divider-line,
.workspace.is-dragging .split-divider .split-divider-line {
  background: var(--accent);
  width: 4px;
  box-shadow: 0 0 10px var(--accent-glow);
}

.split-divider:hover .split-divider-handle,
.workspace.is-dragging .split-divider .split-divider-handle {
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.08);
  box-shadow: var(--shadow-elev), 0 0 12px var(--accent-glow);
}

/* ---------- 출력 패널 헤더 (우) ---------- */
.pane-header-output {
  justify-content: space-between;
  gap: 16px;
  padding: 0 14px 0 12px;
}

.output-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

/* 탭 스위처 */
.tabs {
  display: flex;
  background: var(--bg-workspace);
  border-radius: var(--radius);
  padding: 3px;
  border: 1px solid var(--border);
}

.tab {
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.tab:hover {
  color: var(--fg-strong);
}

.tab.is-active {
  background: var(--bg-elev);
  color: var(--accent);
  box-shadow: var(--shadow);
}

/* 뷰어 테마 셀렉트박스 */
.theme-selector-box {
  width: 130px;
  position: relative;
  transition: var(--transition);
}

.select-theme {
  padding: 6px 28px 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

.theme-selector-box::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 5px;
  background-color: var(--fg-muted);
  clip-path: polygon(100% 0, 0 0, 50% 100%);
  pointer-events: none;
}

.output-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- 출력 뷰어 영역 (우) ---------- */
.output-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

/* HTML 프리뷰 */
.preview {
  flex: 1;
  overflow-y: auto;
  padding: 36px 40px;
  background: var(--bg-input);
  color: var(--fg);
  display: none;
  min-height: 0;
  outline: none;
}

.preview.is-active {
  display: block;
}

/* HTML 소스코드 보기 */
.source {
  flex: 1;
  overflow: auto;
  margin: 0;
  padding: 24px;
  background: var(--bg-source);
  color: var(--code-fg);
  font-family: "Fira Code", ui-monospace, monospace;
  font-size: 13.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  display: none;
  min-height: 0;
  outline: none;
}

.source.is-active {
  display: block;
}

.source code {
  background: transparent;
  color: inherit;
  padding: 0;
}

/* ---------- 4대 문서 스타일 프리셋 테마 ---------- */

/* 1. GitHub Theme (.theme-github) */
.theme-github {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--fg);
}

.theme-github h1, .theme-github h2, .theme-github h3,
.theme-github h4, .theme-github h5, .theme-github h6 {
  font-weight: 600;
  line-height: 1.25;
  margin-top: 24px;
  margin-bottom: 16px;
  color: var(--fg-strong);
}

.theme-github h1 { font-size: 2em; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.theme-github h2 { font-size: 1.5em; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.theme-github h3 { font-size: 1.25em; }

.theme-github p { margin-top: 0; margin-bottom: 16px; }

.theme-github a {
  color: #0969da;
  text-decoration: none;
}
.theme-github a:hover {
  text-decoration: underline;
}

.theme-github ul, .theme-github ol {
  padding-left: 2em;
  margin-top: 0;
  margin-bottom: 16px;
}

.theme-github li { margin-top: 0.25em; }

.theme-github blockquote {
  padding: 0 1em;
  color: var(--fg-muted);
  border-left: 0.25em solid #d0d7de;
  margin: 0 0 16px 0;
}

.theme-github code {
  padding: .2em .4em;
  margin: 0;
  font-size: 85%;
  background-color: rgba(175,184,193,0.2);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
}

.theme-github pre {
  padding: 16px;
  overflow: auto;
  font-size: 85%;
  line-height: 1.45;
  background-color: var(--code-bg);
  color: var(--code-fg);
  border-radius: 6px;
  margin-bottom: 16px;
}

.theme-github pre code {
  background-color: transparent;
  padding: 0;
  font-size: 100%;
  color: inherit;
  border-radius: 0;
}

.theme-github table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0;
  margin-bottom: 16px;
}

.theme-github th, .theme-github td {
  padding: 6px 13px;
  border: 1px solid var(--border);
}

.theme-github th {
  font-weight: 600;
  background-color: var(--bg);
}

.theme-github tr:nth-child(even) {
  background-color: rgba(246, 248, 250, 0.5);
}

.theme-github hr {
  height: .25em;
  padding: 0;
  margin: 24px 0;
  background-color: var(--border);
  border: 0;
}

/* 2. Modern Minimalist Theme (.theme-minimalist) */
.theme-minimalist {
  font-family: "Inter", "Pretendard Variable", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: #334155; /* 부드러운 슬레이트 그레이 */
}

.theme-minimalist h1, .theme-minimalist h2, .theme-minimalist h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #0f172a;
  margin-top: 1.8em;
  margin-bottom: 0.6em;
}

.theme-minimalist h1 { font-size: 2.25rem; line-height: 1.15; }
.theme-minimalist h2 { font-size: 1.6rem; }
.theme-minimalist h3 { font-size: 1.25rem; }

.theme-minimalist p { margin-bottom: 1.25em; }

.theme-minimalist a {
  color: #6366f1; /* 깔끔한 인디고 */
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
  transition: var(--transition-fast);
}

.theme-minimalist a:hover {
  color: #4f46e5;
  border-bottom-color: #4f46e5;
}

.theme-minimalist ul, .theme-minimalist ol {
  margin-bottom: 1.25em;
  padding-left: 1.5em;
}

.theme-minimalist li {
  margin-bottom: 0.4em;
}

.theme-minimalist blockquote {
  font-style: italic;
  font-size: 1.05rem;
  border-left: 3px solid #6366f1;
  padding: 0.5em 0 0.5em 1.25em;
  margin: 1.5em 0;
  color: #475569;
}

.theme-minimalist code {
  font-family: "Fira Code", monospace;
  font-size: 0.88em;
  background: #f1f5f9;
  color: #4f46e5;
  padding: 0.2em 0.4em;
  border-radius: 4px;
}

.theme-minimalist pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 20px;
  border-radius: 12px;
  overflow-x: auto;
  margin: 1.5em 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.theme-minimalist pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: 0.9em;
}

.theme-minimalist table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
}

.theme-minimalist th, .theme-minimalist td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
}

.theme-minimalist th {
  font-weight: 600;
  color: #0f172a;
  border-bottom: 2px solid #e2e8f0;
}

.theme-minimalist tr:hover {
  background-color: #f8fafc;
}

.theme-minimalist hr {
  border: 0;
  border-top: 1px dashed #e2e8f0;
  margin: 2.5em 0;
}

/* 3. Warm Sepia Theme (.theme-sepia) */
.theme-sepia {
  font-family: "Pretendard Variable", sans-serif;
  font-size: 16px;
  line-height: 1.8;
  color: #433422; /* 딥 브라운 */
  background-color: #fdf6e3 !important; /* 따뜻한 미색 */
}

/* 다크모드에서도 세피아 고유 색상 유지 */
:root[data-theme="dark"] .theme-sepia {
  background-color: #fdf6e3 !important;
  color: #433422 !important;
}

.theme-sepia h1, .theme-sepia h2, .theme-sepia h3,
.theme-sepia h4, .theme-sepia h5, .theme-sepia h6 {
  font-family: "Pretendard Variable", sans-serif;
  font-weight: 700;
  color: #2e1d0c;
  margin-top: 1.8em;
  margin-bottom: 0.6em;
}

.theme-sepia h1 { font-size: 2rem; border-bottom: 1px solid #ecdcb9; padding-bottom: 0.3em; }
.theme-sepia h2 { font-size: 1.5rem; border-bottom: 1px solid #ecdcb9; padding-bottom: 0.2em; }

.theme-sepia a {
  color: #b58900;
  text-decoration: none;
  border-bottom: 1px solid rgba(181, 137, 0, 0.3);
}

.theme-sepia a:hover {
  color: #cb4b16;
  border-bottom-color: #cb4b16;
}

.theme-sepia blockquote {
  margin: 1.5em 0;
  padding: 0.5em 1.25em;
  background: #f5ecc8;
  border-left: 4px solid #b58900;
  color: #584b3c;
  border-radius: 0 8px 8px 0;
}

.theme-sepia code {
  font-family: monospace;
  background: #f6ecce;
  color: #b58900;
  padding: 0.15em 0.3em;
  border-radius: 4px;
}

.theme-sepia pre {
  background: #073642; /* 솔라라이즈드 다크 그린 계열 */
  color: #93a1a1;
  padding: 16px 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.5em 0;
}

.theme-sepia pre code {
  background: transparent;
  color: #839496;
}

.theme-sepia table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
}

.theme-sepia th, .theme-sepia td {
  padding: 10px 14px;
  border: 1px solid #ecdcb9;
}

.theme-sepia th {
  background-color: #f5ecc8;
  font-weight: 700;
}

.theme-sepia hr {
  border: 0;
  border-top: 1px solid #ecdcb9;
  margin: 2em 0;
}

/* 4. Classic Serif Theme (.theme-serif) */
.theme-serif {
  font-family: "Georgia", "Times New Roman", "Chosunilbo_myungjo", "KoPub Batang", "Noto Serif KR", serif;
  font-size: 16.5px;
  line-height: 1.85;
  color: #1a1a1a;
  padding: 40px 48px;
}

.theme-serif h1, .theme-serif h2, .theme-serif h3 {
  font-family: "Georgia", "Chosunilbo_myungjo", serif;
  font-weight: 700;
  color: #000000;
  margin-top: 2em;
  margin-bottom: 0.7em;
  text-align: center; /* 세리프 에디토리얼 감성으로 중앙 정렬 */
}

.theme-serif h1 {
  font-size: 2.2rem;
  letter-spacing: -0.02em;
  position: relative;
  padding-bottom: 15px;
}

.theme-serif h1::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 1px;
  background-color: #000000;
}

.theme-serif h2 {
  font-size: 1.6rem;
  font-style: italic;
}

.theme-serif p {
  margin-bottom: 1.4em;
  text-align: justify; /* 양끝 정렬 */
}

.theme-serif a {
  color: #1a1a1a;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.theme-serif a:hover {
  opacity: 0.7;
}

.theme-serif blockquote {
  margin: 2em 1.5em;
  font-style: italic;
  font-size: 1.1em;
  line-height: 1.8;
  text-align: center;
  color: #4a4a4a;
  position: relative;
  padding: 10px 0;
}

.theme-serif blockquote::before {
  content: "“";
  font-family: Georgia, serif;
  font-size: 3em;
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  color: #cccccc;
  line-height: 1;
}

.theme-serif code {
  font-family: monospace;
  font-size: 0.9em;
  background: #f7f7f7;
  color: #333333;
  padding: 0.2em 0.4em;
  border-radius: 2px;
  border: 1px solid #e0e0e0;
}

.theme-serif pre {
  background: #1a1a1a;
  color: #ffffff;
  padding: 18px 22px;
  border-radius: 4px;
  margin: 1.8em 0;
  text-align: left;
}

.theme-serif pre code {
  background: transparent;
  color: inherit;
  border: 0;
}

.theme-serif table {
  width: 100%;
  border-collapse: collapse;
  margin: 2em 0;
}

.theme-serif th, .theme-serif td {
  padding: 10px 14px;
  border-top: 1px solid #cccccc;
  border-bottom: 1px solid #cccccc;
}

.theme-serif th {
  font-weight: 700;
  background-color: #f7f7f7;
}

.theme-serif hr {
  border: 0;
  border-top: 1px solid #cccccc;
  width: 30%;
  margin: 3em auto;
}

/* 공용 체크박스 및 테이블 스타일 */
.preview ul li input[type="checkbox"] {
  margin-right: 8px;
  accent-color: var(--accent);
  transform: translateY(1.5px);
}

.preview img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  display: block;
  margin: 1.5em auto;
  box-shadow: var(--shadow);
}

/* ---------- 푸터 영역 ---------- */
.app-footer {
  height: var(--footer-h);
  padding: 0 28px;
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}

.footer-repo-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition-fast);
}

.footer-repo-link:hover {
  color: var(--accent-hover);
  text-shadow: 0 0 8px var(--accent-glow);
}

.github-icon {
  width: 16px;
  height: 16px;
}

/* ---------- 토스트 알림 ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 15px) scale(0.95);
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #ffffff;
  padding: 10px 24px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

/* ---------- 태블릿 / 모바일 반응형 대응 ---------- */
@media (max-width: 1024px) {
  .app-header {
    padding: 0 20px;
  }
}

@media (max-width: 820px) {
  /* 820px 이하에서 1열 수직 분할 구조로 변경 */
  .workspace {
    flex-direction: column;
    padding: 12px;
    gap: 12px;
  }

  .pane {
    width: 100% !important;
    height: 50% !important; /* 디바이스 높이 절반씩 */
  }

  .pane-input {
    height: calc(45vh - 6px) !important;
  }

  .pane-output {
    flex: 1 !important;
    height: auto !important;
  }

  /* 수직 레이아웃일 때는 가로 크기 디바이더 드래그 무시 */
  .split-divider {
    display: none !important;
  }

  .app-header {
    height: auto;
    padding: 12px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .header-actions {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
  }

  .custom-select-wrapper {
    flex: 1;
    min-width: 130px;
  }

  .btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  .app-footer {
    padding: 0 16px;
    font-size: 11px;
    height: auto;
    padding: 10px 16px;
    flex-direction: column;
    gap: 6px;
    align-items: center;
  }
}

@media (max-width: 480px) {
  .header-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .custom-select-wrapper {
    grid-column: span 2;
  }

  #toggle-theme {
    grid-column: span 2;
    width: 100%;
  }
  
  .output-actions {
    flex-wrap: wrap;
    gap: 4px;
  }
  
  .output-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 6px 8px;
  }

  .output-header-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
  }

  .theme-selector-box {
    width: 100%;
  }
  
  .pane-header-output {
    height: auto;
    padding: 10px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
}
