* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #0d1117;
  color: #c9d1d9;
}

header {
  height: 50px;
  background: #161b22;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid #30363d;
}

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

.badge {
  background: #21262d;
  border: 1px solid #30363d;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 12px;
  color: #58a6ff;
}

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

select, button {
  background: #21262d;
  color: #c9d1d9;
  border: 1px solid #30363d;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

select:focus, button:focus {
  border-color: #58a6ff;
}

button.primary {
  background: #238636;
  color: #fff;
  border-color: #2ea043;
  font-weight: bold;
}

button.primary:hover {
  background: #2ea043;
}

.container {
  flex: 1;
  display: flex;
  overflow: hidden;
}

#editor {
  width: 50%;
  height: 100%;
  background: #0d1117;
  color: #e6edf3;
  font-family: "Fira Code", monospace;
  font-size: 14px;
  line-height: 1.6;
  padding: 16px;
  border: none;
  border-right: 1px solid #30363d;
  resize: none;
  outline: none;
}

#preview {
  width: 50%;
  height: 100%;
  padding: 24px;
  overflow-y: auto;
  line-height: 1.6;
  background: #0d1117;
}

#preview h1, #preview h2, #preview h3 {
  border-bottom: 1px solid #21262d;
  padding-bottom: 8px;
  margin-top: 24px;
  margin-bottom: 16px;
}

#preview p, #preview ul, #preview pre {
  margin-bottom: 16px;
}

#preview pre {
  background: #161b22;
  padding: 16px;
  border-radius: 6px;
  overflow-x: auto;
  border: 1px solid #30363d;
}

#preview img {
  max-width: 100%;
  border-radius: 6px;
  margin: 12px 0;
  border: 1px solid #30363d;
}

/* 預設為雙欄雙向對開 */
.container {
  flex: 1;
  display: flex;
  overflow: hidden;
}

#editor {
  width: 50%;
  height: 100%;
  background: #0d1117;
  color: #e6edf3;
  font-family: "Fira Code", monospace;
  font-size: 14px;
  line-height: 1.6;
  padding: 16px;
  border: none;
  border-right: 1px solid #30363d;
  resize: none;
  outline: none;
}

#preview {
  width: 50%;
  height: 100%;
  padding: 24px;
  overflow-y: auto;
  line-height: 1.6;
  background: #0d1117;
}

/* --- 切換為「純預覽模式」時的覆蓋樣式 --- */
.container.mode-preview #editor {
  display: none; /* 隱藏編輯器 */
}

.container.mode-preview #preview {
  width: 100%; /* 預覽區佔滿全螢幕 */
  max-width: 900px; /* 控制文字閱讀寬度，維持排版舒適度 */
  margin: 0 auto;
}