/* ============================================================
   Markdown Editor — GitHub Primer inspired
   Light / dark, split pane, no dependencies
   ============================================================ */

:root {
  color-scheme: light;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", "Courier New", monospace;

  --bg: #ffffff;
  --bg-subtle: #f6f8fa;
  --fg: #1f2328;
  --fg-muted: #59636e;
  --fg-subtle: #6e7781;
  --border: #d1d9e0;
  --border-muted: #d8dee4;
  --hover: rgba(208, 215, 222, 0.36);
  --active: rgba(208, 215, 222, 0.56);
  --accent: #0969da;
  --accent-subtle: #ddf4ff;
  --success: #1a7f37;
  --danger: #cf222e;
  --code-bg: rgba(175, 184, 193, 0.2);
  --selection: rgba(84, 174, 255, 0.36);
  --toast-bg: #1f2328;
  --toast-fg: #ffffff;
  --toast-border: transparent;
  --shadow-overlay: 0 8px 24px rgba(140, 149, 159, 0.22);

  --syn-kw: #cf222e;
  --syn-str: #0a3069;
  --syn-num: #0550ae;
  --syn-com: #59636e;
  --syn-fn: #8250df;
  --syn-tag: #116329;
  --syn-attr: #0550ae;
  --syn-punc: #1f2328;

  --header-height: 48px;
  --bar-height: 38px;
  --status-height: 30px;
  --pad-top: 24px;
  --editor-pad-x: 24px;
  --preview-pad-x: 32px;

  --radius: 6px;
  --font-size-editor: 14px;
  --line-height-editor: 1.7;
  --duration: 0.12s;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0d1117;
  --bg-subtle: #161b22;
  --fg: #e6edf3;
  --fg-muted: #9198a1;
  --fg-subtle: #6e7681;
  --border: #30363d;
  --border-muted: #21262d;
  --hover: rgba(177, 186, 196, 0.12);
  --active: rgba(177, 186, 196, 0.2);
  --accent: #4493f8;
  --accent-subtle: rgba(56, 139, 253, 0.15);
  --success: #3fb950;
  --danger: #f85149;
  --code-bg: rgba(110, 118, 129, 0.4);
  --selection: rgba(56, 139, 253, 0.35);
  --toast-bg: #161b22;
  --toast-fg: #e6edf3;
  --toast-border: #30363d;
  --shadow-overlay: 0 8px 24px rgba(1, 4, 9, 0.7);

  --syn-kw: #ff7b72;
  --syn-str: #a5d6ff;
  --syn-num: #79c0ff;
  --syn-com: #8b949e;
  --syn-fn: #d2a8ff;
  --syn-tag: #7ee787;
  --syn-attr: #79c0ff;
  --syn-punc: #e6edf3;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button {
  font: inherit;
  color: inherit;
}

button,
[role="separator"] {
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: var(--selection);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

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

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 8px;
  background-color: var(--border);
  background-clip: padding-box;
}

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

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

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  display: block;
}

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

.skip-link {
  position: fixed;
  top: 8px;
  left: -9999px;
  z-index: 100;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font-size: 13px;
  text-decoration: none;
  box-shadow: var(--shadow-overlay);
}

.skip-link:focus {
  left: 8px;
}

/* ============================================================
   Header
   ============================================================ */

.app-header {
  position: relative;
  z-index: 5;
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
  height: var(--header-height);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  user-select: none;
  -webkit-user-select: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-mark {
  width: 24px;
  height: 24px;
  flex: none;
  color: var(--fg);
}

.brand-title {
  margin: 0;
  overflow: hidden;
  color: var(--fg);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-badge {
  flex: none;
  height: 18px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 2em;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 16px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.header-divider {
  width: 1px;
  height: 20px;
  margin: 0 6px;
  background: var(--border-muted);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  transition: background-color var(--duration) ease, color var(--duration) ease;
}

.icon-button:hover {
  background: var(--hover);
  color: var(--fg);
}

.icon-button:active {
  background: var(--active);
}

.icon-button--small {
  width: 26px;
  height: 26px;
}

.icon-button--small .icon {
  width: 15px;
  height: 15px;
}

/* Theme segmented control */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 1px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
}

.theme-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  transition: background-color var(--duration) ease, color var(--duration) ease;
}

.theme-option .icon {
  width: 14px;
  height: 14px;
}

.theme-option:hover {
  background: var(--hover);
  color: var(--fg);
}

.theme-option[aria-pressed="true"] {
  background: var(--bg);
  color: var(--fg);
  box-shadow: 0 0 0 1px var(--border), 0 1px 2px rgba(31, 35, 40, 0.06);
}

/* ============================================================
   Mobile view switch
   ============================================================ */

.mobile-view-switch {
  display: none;
  flex: none;
  align-items: center;
  justify-content: center;
  height: 42px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  user-select: none;
  -webkit-user-select: none;
}

.segmented {
  display: inline-flex;
  gap: 1px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
}

.segmented-option {
  min-width: 76px;
  height: 26px;
  padding: 0 14px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.segmented-option[aria-pressed="true"] {
  background: var(--bg);
  color: var(--fg);
  box-shadow: 0 0 0 1px var(--border);
}

/* ============================================================
   Workspace / panes
   ============================================================ */

.workspace {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

.pane-editor {
  flex: 0 0 var(--editor-width, 50%);
}

.pane-preview {
  flex: 1 1 auto;
}

.splitter {
  position: relative;
  z-index: 4;
  flex: 0 0 1px;
  background: var(--border);
  cursor: col-resize;
  touch-action: none;
}

.splitter::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -5px;
  right: -5px;
}

.splitter::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 28px;
  border-radius: 2px;
  background: transparent;
  transform: translate(-50%, -50%);
  transition: background-color var(--duration) ease;
}

.splitter:hover::after,
.splitter:focus-visible::after,
.workspace.is-resizing .splitter::after {
  background: var(--fg-subtle);
}

.splitter:focus-visible {
  outline: none;
}

.splitter:focus-visible::after {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.workspace.is-resizing,
.workspace.is-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.pane-bar {
  position: relative;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  height: var(--bar-height);
  padding: 0 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  user-select: none;
  -webkit-user-select: none;
}

.preview-bar {
  padding: 0 10px 0 16px;
}

.editor-bar::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 1px;
  z-index: 2;
  width: 34px;
  background: linear-gradient(to right, transparent, var(--bg) 80%);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration) ease;
}

.editor-bar.has-overflow:not(.at-end)::after {
  opacity: 1;
}

.pane-bar-label {
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ============================================================
   Toolbar
   ============================================================ */

.toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 2px;
  scrollbar-width: none;
}

.toolbar::-webkit-scrollbar {
  display: none;
}

.toolbar-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  transition: background-color var(--duration) ease, color var(--duration) ease;
}

.toolbar-button:hover {
  background: var(--hover);
  color: var(--fg);
}

.toolbar-button:active {
  background: var(--active);
}

.toolbar-sep {
  flex: none;
  width: 1px;
  height: 16px;
  margin: 0 4px;
  background: var(--border-muted);
}

.glyph {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

.glyph-h {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0;
}

.glyph-bold {
  font-weight: 800;
}

.glyph-italic {
  font-style: italic;
  font-weight: 600;
}

.glyph-strike {
  font-weight: 500;
  text-decoration: line-through;
  text-decoration-thickness: 1.25px;
}

.glyph-ol {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

/* ============================================================
   Editor
   ============================================================ */

.editor-area {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

.editor-input,
.editor-mirror {
  font-family: var(--font-mono);
  font-size: var(--font-size-editor);
  font-weight: 400;
  line-height: var(--line-height-editor);
  letter-spacing: 0;
  tab-size: 2;
  -moz-tab-size: 2;
}

.editor-input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: var(--pad-top) var(--editor-pad-x) 64px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--fg);
  caret-color: var(--accent);
  resize: none;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.editor-input::placeholder {
  color: var(--fg-subtle);
  opacity: 1;
}

.editor-input:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--border);
}

.editor-mirror {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  padding: var(--pad-top) var(--editor-pad-x) 64px;
  visibility: hidden;
  pointer-events: none;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
  contain: layout style;
}

.editor-mirror .mirror-line {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* ============================================================
   Preview
   ============================================================ */

.preview-area {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.preview-content {
  padding: var(--pad-top) var(--preview-pad-x) 64px;
}

.markdown-body {
  max-width: 780px;
  margin: 0 auto;
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.markdown-body > *:first-child {
  margin-top: 0 !important;
}

.markdown-body > *:last-child {
  margin-bottom: 0 !important;
}

.markdown-body p,
.markdown-body blockquote,
.markdown-body ul,
.markdown-body ol,
.markdown-body table,
.markdown-body pre,
.markdown-body .table-wrap {
  margin-top: 0;
  margin-bottom: 16px;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin-top: 24px;
  margin-bottom: 16px;
  font-weight: 600;
  line-height: 1.25;
  text-wrap: balance;
}

.markdown-body h1 {
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border-muted);
  font-size: 2em;
  letter-spacing: -0.02em;
}

.markdown-body h2 {
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border-muted);
  font-size: 1.5em;
  letter-spacing: -0.01em;
}

.markdown-body h3 {
  font-size: 1.25em;
}

.markdown-body h4 {
  font-size: 1em;
}

.markdown-body h5 {
  font-size: 0.875em;
}

.markdown-body h6 {
  color: var(--fg-muted);
  font-size: 0.85em;
}

.markdown-body a {
  color: var(--accent);
  text-decoration: none;
  overflow-wrap: break-word;
}

.markdown-body a:hover {
  text-decoration: underline;
}

.markdown-body strong {
  font-weight: 600;
}

.markdown-body del {
  color: var(--fg-muted);
}

.markdown-body code {
  margin: 0;
  padding: 0.2em 0.4em;
  border-radius: var(--radius);
  background-color: var(--code-bg);
  font-family: var(--font-mono);
  font-size: 85%;
  white-space: break-spaces;
}

.markdown-body pre {
  overflow: auto;
  padding: 16px;
  border-radius: var(--radius);
  background-color: var(--bg-subtle);
  font-size: 85%;
  line-height: 1.45;
  word-wrap: normal;
}

.markdown-body pre code {
  display: inline;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 100%;
  line-height: inherit;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
}

.markdown-body blockquote {
  padding: 0 1em;
  border-left: 0.25em solid var(--border);
  color: var(--fg-muted);
}

.markdown-body blockquote > :first-child {
  margin-top: 0;
}

.markdown-body blockquote > :last-child {
  margin-bottom: 0;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 2em;
}

.markdown-body li + li {
  margin-top: 0.25em;
}

.markdown-body li > ul,
.markdown-body li > ol {
  margin-top: 0.25em;
  margin-bottom: 0;
}

.markdown-body li > p {
  margin-top: 16px;
  margin-bottom: 16px;
}

.markdown-body li > p:last-child {
  margin-bottom: 0;
}

.markdown-body li > p:first-child {
  margin-top: 0;
}

.markdown-body .contains-task-list {
  padding-left: 2em;
}

.markdown-body .task-list-item {
  list-style-type: none;
}

.markdown-body .task-list-item-checkbox {
  position: relative;
  width: 13px;
  height: 13px;
  margin: 0 0.68em 0 -1.55em;
  border: 1px solid var(--border);
  border-radius: 3px;
  background-color: var(--bg);
  vertical-align: -1px;
  appearance: none;
  -webkit-appearance: none;
  cursor: default;
}

.markdown-body .task-list-item-checkbox:checked {
  border-color: var(--accent);
  background-color: var(--accent);
}

.markdown-body .task-list-item-checkbox:checked::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 3.5px;
  width: 3px;
  height: 6px;
  border: solid #ffffff;
  border-width: 0 1.6px 1.6px 0;
  transform: rotate(45deg);
}

.markdown-body table {
  display: table;
  border-spacing: 0;
  border-collapse: collapse;
  width: auto;
  max-width: 100%;
}

.markdown-body .table-wrap {
  overflow-x: auto;
}

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

.markdown-body th {
  background-color: var(--bg-subtle);
  font-weight: 600;
  text-align: left;
}

.markdown-body .align-left {
  text-align: left;
}

.markdown-body .align-center {
  text-align: center;
}

.markdown-body .align-right {
  text-align: right;
}

.markdown-body tr:nth-child(2n) {
  background-color: var(--bg-subtle);
}

.markdown-body img {
  max-width: 100%;
  height: auto;
  box-sizing: content-box;
  vertical-align: middle;
}

.markdown-body hr {
  height: 0.25em;
  margin: 24px 0;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background-color: var(--border);
}

.markdown-body kbd {
  display: inline-block;
  padding: 3px 5px;
  border: 1px solid var(--border);
  border-bottom-color: var(--border);
  border-radius: 6px;
  background-color: var(--bg-subtle);
  box-shadow: inset 0 -1px 0 var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 10px;
  vertical-align: middle;
}

/* Syntax highlighting */
.tok-kw { color: var(--syn-kw); }
.tok-str { color: var(--syn-str); }
.tok-num { color: var(--syn-num); }
.tok-com { color: var(--syn-com); }
.tok-fn { color: var(--syn-fn); }
.tok-tag { color: var(--syn-tag); }
.tok-attr { color: var(--syn-attr); }
.tok-punc { color: var(--syn-punc); }

/* Empty preview */
.preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14vh 24px 24px;
  color: var(--fg-muted);
  text-align: center;
}

.preview-placeholder[hidden] {
  display: none;
}

.preview-placeholder-mark {
  width: 34px;
  height: 34px;
  margin-bottom: 16px;
  color: var(--fg-subtle);
}

.preview-placeholder-title {
  margin: 0 0 6px;
  color: var(--fg);
  font-size: 14px;
  font-weight: 600;
}

.preview-placeholder-text {
  max-width: 34ch;
  margin: 0;
  color: var(--fg-muted);
  font-size: 13px;
  line-height: 1.7;
}

/* ============================================================
   Status bar
   ============================================================ */

.status-bar {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--status-height);
  padding: 0 12px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg-muted);
  font-size: 12px;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}

.status-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.status-item {
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-counts {
  font-variant-numeric: tabular-nums;
}

.status-dot {
  color: var(--border);
}

.status-dot--sm {
  margin: 0 -1px;
}

.save-state {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--fg-muted);
}

.save-state .icon {
  width: 12px;
  height: 12px;
  color: var(--success);
}

.save-state[data-state="saving"] .icon {
  color: var(--fg-subtle);
}

.save-state[data-state="sample"] .icon {
  display: none;
}

.save-state[data-state="error"] {
  color: var(--danger);
}

.save-state[data-state="error"] .icon {
  color: var(--danger);
}

.status-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  margin-right: -8px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg-muted);
  font-size: 12px;
  cursor: pointer;
  transition: background-color var(--duration) ease, color var(--duration) ease;
}

.status-toggle .icon {
  width: 13px;
  height: 13px;
}

.status-toggle:hover {
  background: var(--hover);
  color: var(--fg);
}

.status-toggle[aria-pressed="true"] {
  color: var(--accent);
}

/* ============================================================
   Toast
   ============================================================ */

.toast {
  position: fixed;
  bottom: 48px;
  left: 50%;
  z-index: 60;
  max-width: min(88vw, 420px);
  padding: 7px 14px;
  border: 1px solid var(--toast-border);
  border-radius: var(--radius);
  background: var(--toast-bg);
  box-shadow: var(--shadow-overlay);
  color: var(--toast-fg);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

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

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 900px) {
  :root {
    --pad-top: 18px;
    --editor-pad-x: 18px;
    --preview-pad-x: 20px;
    --bar-height: 40px;
  }

  body {
    overflow: hidden;
  }

  .mobile-view-switch {
    display: flex;
  }

  .splitter {
    display: none;
  }

  .pane-editor,
  .pane-preview {
    flex: 1 1 100%;
  }

  .workspace[data-view="editor"] .pane-preview,
  .workspace[data-view="preview"] .pane-editor {
    display: none;
  }

  .status-toggle,
  .status-encoding {
    display: none;
  }

  .status-bar {
    padding: 0 14px;
  }

  .markdown-body {
    font-size: 15px;
  }

  .preview-content {
    padding-bottom: 48px;
  }

  .editor-input,
  .editor-mirror {
    padding-bottom: 48px;
  }
}

@media (max-width: 640px) {
  .app-header {
    gap: 8px;
    padding: 0 12px;
  }

  .brand-badge,
  .header-divider {
    display: none;
  }

  .brand-title {
    font-size: 13px;
  }

  .theme-option {
    width: 24px;
  }

  .theme-switch {
    gap: 0;
  }

  .toolbar {
    gap: 1px;
  }

  .segmented-option {
    height: 30px;
  }

  .toolbar-button {
    width: 27px;
  }

  .toolbar-sep {
    margin: 0 2px;
  }

  .status-group {
    gap: 6px;
  }

  .status-bar {
    padding: 0 12px;
    font-size: 11px;
  }

  .preview-bar {
    padding: 0 8px 0 14px;
  }
}

@media (max-width: 380px) {
  .header-action-secondary {
    display: none;
  }

  .brand-title {
    max-width: 92px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ============================================================
   Print — just the rendered document
   ============================================================ */

@media print {
  :root,
  :root[data-theme="dark"] {
    color-scheme: light;
    --bg: #ffffff;
    --fg: #1f2328;
    --fg-muted: #59636e;
    --border: #d1d9e0;
    --border-muted: #d8dee4;
    --bg-subtle: #f6f8fa;
    --code-bg: #f6f8fa;
    --accent: #0969da;
    --syn-kw: #cf222e;
    --syn-str: #0a3069;
    --syn-num: #0550ae;
    --syn-com: #59636e;
    --syn-fn: #8250df;
    --syn-tag: #116329;
    --syn-attr: #0550ae;
    --syn-punc: #1f2328;
  }

  html,
  body {
    height: auto;
    overflow: visible;
    background: #ffffff;
  }

  .app-header,
  .mobile-view-switch,
  .status-bar,
  .splitter,
  .pane-editor,
  .preview-placeholder,
  .toast,
  .skip-link {
    display: none !important;
  }

  .workspace,
  .workspace[data-view] .pane-preview,
  .pane-preview,
  .preview-area,
  .preview-content {
    display: block !important;
    overflow: visible;
    height: auto;
    padding: 0;
  }

  .markdown-body {
    max-width: none;
    color: #1f2328;
  }

  .markdown-body pre {
    white-space: pre-wrap;
    word-break: break-word;
  }

  .markdown-body a {
    color: #0969da;
  }
}
