.main-area {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* ── Editor wrapper ── */
.editor-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 60px 40px 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
}
.editor-wrapper::-webkit-scrollbar { width: 4px; }
.editor-wrapper::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 2px; }

.editor-inner {
  width: 100%;
  max-width: 720px;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

/* ── Page title ── */
.page-title-field {
  font-family: var(--font-editor);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  resize: none;
  overflow: hidden;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}
.page-title-field:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  opacity: 0.4;
  pointer-events: none;
}
.page-title-field::placeholder { color: var(--text-muted); opacity: 0.4; }

.page-meta {
  margin-bottom: 28px;
}

.page-title-wrapper {
  display: flex;
  flex-direction: column;
}

.page-label { display: none; }

/* ── Tiptap editor ── */
.editor-divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 24px;
}

.tiptap-editor {
  font-family: var(--font-editor);
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
  outline: none;
  min-height: 420px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
}

.tiptap-editor > * + * { margin-top: 0.5em; }

.tiptap-editor p { margin: 0.15em 0; }

.tiptap-editor h1 {
  font-size: 1.75em; font-weight: 700;
  letter-spacing: -0.3px; line-height: 1.25;
  margin: 1.2em 0 0.4em;
}
.tiptap-editor h2 {
  font-size: 1.35em; font-weight: 600;
  margin: 1em 0 0.35em;
}
.tiptap-editor h3 {
  font-size: 1.1em; font-weight: 600;
  margin: 0.9em 0 0.3em;
}

.tiptap-editor strong { font-weight: 600; }
.tiptap-editor em    { font-style: italic; }
.tiptap-editor s     { text-decoration: line-through; }

.tiptap-editor ul, .tiptap-editor ol {
  padding-left: 1.4em;
  margin: 0.4em 0;
}
.tiptap-editor li { margin: 0.15em 0; }

.tiptap-editor blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 14px;
  color: var(--text-muted);
  margin: 0.6em 0;
}

.tiptap-editor code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
}

.tiptap-editor pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0.6em 0;
}
.tiptap-editor pre code {
  background: none; border: none; padding: 0;
  font-size: 13px;
}

.tiptap-editor a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tiptap-editor hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.2em 0;
}

/* Placeholder */
.tiptap-editor p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  opacity: 0.45;
  pointer-events: none;
  float: left;
  height: 0;
}

/* Selection highlight */
.tiptap-editor ::selection { background: var(--accent-light); }

/* ── Floating toolbar ── */
.bubble-toolbar {
  position: fixed;
  z-index: 800;
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.bubble-toolbar.visible {
  pointer-events: all;
  opacity: 1;
  transform: translateY(0);
}

.bubble-btn {
  background: none; border: none; cursor: pointer;
  padding: 5px 8px; border-radius: 4px;
  font-size: 13px; font-weight: 600;
  color: var(--text-muted);
  transition: background var(--trans), color var(--trans);
  font-family: var(--font-ui);
  line-height: 1;
}
.bubble-btn:hover  { background: var(--surface); color: var(--text); }
.bubble-btn.active { background: var(--accent-light); color: var(--accent); }
.bubble-sep { width: 1px; height: 18px; background: var(--border); margin: 0 2px; }

/* Link input in bubble */
.bubble-link-input {
  border: none; outline: none; background: transparent;
  font-size: 13px; color: var(--text); font-family: inherit;
  width: 200px; padding: 4px 4px;
}
.bubble-link-wrap {
  display: flex; align-items: center; gap: 4px;
}

/* ── Save indicator ── */
.save-indicator {
  position: fixed;
  bottom: 16px; right: 20px;
  font-size: 11px; color: var(--text-muted);
  transition: opacity 0.3s ease;
  opacity: 0;
}
.save-indicator.visible { opacity: 1; }
