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

:root {
  --text: rgb(55, 53, 47);
  --text-light: rgba(55, 53, 47, 0.65);
  --text-faint: rgba(55, 53, 47, 0.4);
  --border: rgba(55, 53, 47, 0.09);
  --hover: rgba(55, 53, 47, 0.06);
  --code-bg: #f7f6f3;
  --accent: rgb(35, 131, 226);
  --shadow: rgba(15, 15, 15, 0.05) 0 0 0 1px,
            rgba(15, 15, 15, 0.1) 0 3px 6px,
            rgba(15, 15, 15, 0.2) 0 9px 24px;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica,
    "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji";
  color: var(--text);
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.topbar-title {
  font-size: 14px;
  font-weight: 600;
}

.topbar-hint {
  font-size: 12px;
  color: var(--text-light);
}

.topbar-hint kbd {
  font-family: inherit;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 11px;
}

/* ---------- Split layout ---------- */

.split {
  display: flex;
  flex: 1;
  min-height: 0;
}

.pane {
  width: 50%;
  overflow-y: auto;
}

.pane-editor {
  border-right: 1px solid var(--border);
  display: flex;
}

#editor {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  padding: 40px 48px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  caret-color: var(--text);
}

#editor::placeholder {
  color: var(--text-faint);
}

/* ---------- Preview (Notion page look) ---------- */

.preview {
  padding: 40px 48px;
  max-width: 760px;
  font-size: 16px;
  line-height: 1.6;
  word-wrap: break-word;
}

.preview h1 {
  font-size: 2em;
  font-weight: 700;
  margin: 0.9em 0 0.3em;
  line-height: 1.25;
}

.preview h2 {
  font-size: 1.5em;
  font-weight: 600;
  margin: 1em 0 0.25em;
  line-height: 1.3;
}

.preview h3 {
  font-size: 1.25em;
  font-weight: 600;
  margin: 0.9em 0 0.2em;
}

.preview h1:first-child,
.preview h2:first-child,
.preview h3:first-child {
  margin-top: 0;
}

.preview p {
  margin: 4px 0;
  padding: 3px 0;
}

.preview ul,
.preview ol {
  margin: 4px 0;
  padding-left: 26px;
}

.preview li {
  padding: 2px 0;
}

.preview ul.todo-list {
  list-style: none;
  padding-left: 4px;
}

.preview ul.todo-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.preview ul.todo-list input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  position: relative;
  top: 2px;
}

.preview ul.todo-list li.checked span {
  text-decoration: line-through;
  color: var(--text-faint);
}

.preview blockquote {
  border-left: 3px solid var(--text);
  padding: 3px 0 3px 14px;
  margin: 6px 0;
}

.preview code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  background: var(--code-bg);
  color: #eb5757;
  border-radius: 3px;
  padding: 2px 5px;
  font-size: 85%;
}

.preview pre {
  background: var(--code-bg);
  border-radius: 4px;
  padding: 16px 20px;
  margin: 8px 0;
  overflow-x: auto;
}

.preview pre code {
  background: none;
  color: var(--text);
  padding: 0;
  font-size: 13px;
  line-height: 1.6;
}

.preview hr {
  border: none;
  border-top: 1px solid rgba(55, 53, 47, 0.16);
  margin: 14px 0;
}

.preview a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--text-faint);
  text-underline-offset: 2px;
}

.preview a:hover {
  color: var(--accent);
}

.preview img {
  max-width: 100%;
  border-radius: 4px;
  margin: 6px 0;
}

/* ---------- Slash menu ---------- */

.slash-menu {
  position: absolute;
  z-index: 100;
  width: 320px;
  max-height: 320px;
  overflow-y: auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 6px 0;
}

.slash-menu-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-light);
  padding: 6px 14px 4px;
}

.slash-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px;
  cursor: pointer;
}

.slash-item.active {
  background: var(--hover);
}

.slash-item-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 16px;
  font-weight: 600;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
}

.slash-item-title {
  font-size: 14px;
}

.slash-item-hint {
  font-size: 12px;
  color: var(--text-light);
}

.slash-menu-empty {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-light);
}

/* ---------- Scrollbars ---------- */

.pane::-webkit-scrollbar,
.slash-menu::-webkit-scrollbar {
  width: 9px;
}

.pane::-webkit-scrollbar-thumb,
.slash-menu::-webkit-scrollbar-thumb {
  background: rgba(55, 53, 47, 0.16);
  border-radius: 5px;
  background-clip: padding-box;
  border: 2px solid transparent;
}

.pane::-webkit-scrollbar-thumb:hover {
  background-color: rgba(55, 53, 47, 0.3);
}
