/* FlirtLabz Lexical Editor - Core Styles */
/* Unified across all platforms — v5 Enhanced Toolbar & Icons */

/* ============================================
   VARIABLES & DESIGN TOKENS - DARK THEME ONLY
   ============================================ */
:root {
  --lexical-purple: #7C3AED;
  --lexical-purple-light: #A78BFA;
  --lexical-purple-dark: #5B21B6;
  --lexical-purple-soft: rgba(124, 58, 237, 0.15);

  /* Dark theme colors - matching your site */
  --lexical-surface: #1a1020;
  --lexical-surface-hover: #24152d;
  --lexical-surface-toolbar: rgba(26, 16, 32, 0.95);
  --lexical-text: #f1f5f9;
  --lexical-text-secondary: #a68fb8;
  --lexical-text-muted: #6c6078;
  --lexical-border: rgba(255, 255, 255, 0.06);
  --lexical-border-hover: rgba(255, 255, 255, 0.12);

  --lexical-radius: 12px;
  --lexical-transition: 0.2s ease;
}

/* ============================================
   EDITOR CONTAINER
   ============================================ */
.lexical-editor {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  background: var(--lexical-surface);
  border-radius: var(--lexical-radius);
  border: 1px solid var(--lexical-border);
  transition: border-color var(--lexical-transition);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

.lexical-editor:focus-within {
  border-color: var(--lexical-purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* ============================================
   EDITOR AREA - NO INNER BORDER
   ============================================ */
.lexical-editor .editor-input {
  position: relative;
  box-sizing: border-box;
  min-width: 0;
  min-height: 100px;
  padding: 20px 24px;
  outline: none;
  font-size: 16px;
  line-height: 1.7;
  color: var(--lexical-text);
  max-width: min(100%, 760px);
  margin: 0 auto;
  width: 100%;
  background: transparent;
  border: none;
  overflow-x: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

.lexical-editor-wrapper {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

/* ============================================
   PLACEHOLDER - CSS ONLY (no double text)
   ============================================ */
.lexical-placeholder {
  display: none !important;
}

.lexical-editor .editor-input:empty::before {
  content: attr(data-placeholder);
  color: var(--lexical-text-muted);
  pointer-events: none;
  position: absolute;
  padding: 0;
  font-size: 16px;
  line-height: 1.7;
  opacity: 0.4;
}

/* ============================================
   TOOLBAR - BASE STRUCTURE
   ============================================ */
.lexical-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
  background: var(--lexical-surface-toolbar);
  backdrop-filter: blur(8px);
  border-radius: var(--lexical-radius) var(--lexical-radius) 0 0;
  position: sticky;
  top: 0;
  z-index: 10;
  border: none;
  border-bottom: 1px solid var(--lexical-border);
}

.lexical-toolbar .toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 3px;
  border: 1px solid var(--lexical-border);
  border-radius: 9px;
  background: rgba(255,255,255,.025);
}

.lexical-toolbar .toolbar-group-label {
  padding: 0 6px;
  color: var(--lexical-text-muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.lexical-toolbar select {
  min-height: 34px;
  max-width: 118px;
  padding: 0 25px 0 9px;
  border: 0;
  border-radius: 7px;
  color: var(--lexical-text);
  background: rgba(255,255,255,.05);
  font: inherit;
  font-size: 12px;
}

/* ============================================
   TOOLBAR BUTTONS — Premium Editorial Icons
   ============================================ */
.lexical-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border: none;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 7px;
  color: #c0b0d0;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s ease;
  min-height: 34px;
  min-width: 34px;
  font-weight: 500;
  position: relative;
}

.lexical-toolbar button:hover {
  background: rgba(168, 85, 247, 0.2);
  color: #d4b8f0;
  transform: translateY(-1px);
}

.lexical-toolbar button.active {
  background: rgba(168, 85, 247, 0.28);
  color: #c084fc;
  box-shadow: 0 0 0 1.5px rgba(168, 85, 247, 0.5);
}

/* The editable DOM below is owned and reconciled by Lexical. */
.lexical-editor-canvas { position: relative; }
.lexical-bold { font-weight: 700; }
.lexical-italic { font-style: italic; }
.lexical-underline { text-decoration: underline; text-underline-offset: .16em; }
.lexical-strikethrough { text-decoration: line-through; }
.lexical-underline.lexical-strikethrough { text-decoration: underline line-through; }
.lexical-highlight { background: rgba(250, 204, 21, .24); color: inherit; }
.lexical-inline-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.lexical-link { color: #d8b4fe; text-decoration: underline; text-underline-offset: .18em; }
.lexical-editor .editor-image--left { margin-left: 0; margin-right: auto; }
.lexical-editor .editor-image--right { margin-left: auto; margin-right: 0; }
.lexical-editor .editor-image--center { margin-left: auto; margin-right: auto; }

.lexical-toolbar button:disabled {
  opacity: .42;
  cursor: not-allowed;
  transform: none;
}

/* ============================================
   ICONS — Clear visual symbols
   ============================================ */
.lexical-toolbar .icon-bold,
.lexical-toolbar .icon-italic,
.lexical-toolbar .icon-underline,
.lexical-toolbar .icon-strikethrough,
.lexical-toolbar .icon-link,
.lexical-toolbar .icon-quote,
.lexical-toolbar .icon-spoiler,
.lexical-toolbar .icon-image,
.lexical-toolbar .icon-table,
.lexical-toolbar .icon-bullet,
.lexical-toolbar .icon-numbered,
.lexical-toolbar .icon-list,
.lexical-toolbar .icon-list-numbered,
.lexical-toolbar .icon-checklist,
.lexical-toolbar .icon-horizontal,
.lexical-toolbar .icon-undo,
.lexical-toolbar .icon-redo,
.lexical-toolbar .icon-emoji,
.lexical-toolbar .icon-code,
.lexical-toolbar .icon-code-block,
.lexical-toolbar .icon-highlight,
.lexical-toolbar .icon-callout,
.lexical-toolbar .icon-pull-quote,
.lexical-toolbar .icon-scene,
.lexical-toolbar .icon-align-left,
.lexical-toolbar .icon-align-center,
.lexical-toolbar .icon-align-right,
.lexical-toolbar .icon-align-justify,
.lexical-toolbar .icon-clear-formatting {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  line-height: 1;
  min-width: 22px;
  min-height: 22px;
  font-style: normal;
  color: inherit;
}

/* ── Text Formatting ─────────────────────────── */
.lexical-toolbar .icon-bold {
  font-weight: 800;
  font-size: 16px;
}
.lexical-toolbar .icon-bold::before { content: "B"; }

.lexical-toolbar .icon-italic {
  font-style: italic;
  font-weight: 500;
  font-size: 16px;
}
.lexical-toolbar .icon-italic::before { content: "I"; }

.lexical-toolbar .icon-underline {
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
}
.lexical-toolbar .icon-underline::before { content: "U"; }

.lexical-toolbar .icon-strikethrough {
  text-decoration: line-through;
  font-weight: 600;
}
.lexical-toolbar .icon-strikethrough::before { content: "S"; }

/* ── Lists — HIGHLY VISIBLE WITH PURPLE ──────── */
.lexical-toolbar .icon-list {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #c084fc !important;
}
.lexical-toolbar .icon-list::before { content: "•••"; }
.lexical-toolbar .icon-bullet::before { content: "•••"; }

.lexical-toolbar .icon-list-numbered {
  font-size: 16px;
  font-weight: 800;
  color: #c084fc !important;
}
.lexical-toolbar .icon-list-numbered::before { content: "1."; }
.lexical-toolbar .icon-numbered::before { content: "1."; }

.lexical-toolbar .icon-checklist {
  font-size: 16px;
  font-weight: 700;
  color: #c084fc !important;
}
.lexical-toolbar .icon-checklist::before { content: "☑"; }

/* ── Alignment ────────────────────────────────── */
.lexical-toolbar .icon-align-left {
  font-size: 16px;
  font-weight: 700;
}
.lexical-toolbar .icon-align-left::before { content: "⫷"; }

.lexical-toolbar .icon-align-center {
  font-size: 16px;
  font-weight: 700;
}
.lexical-toolbar .icon-align-center::before { content: "⫷⫸"; }

.lexical-toolbar .icon-align-right {
  font-size: 16px;
  font-weight: 700;
}
.lexical-toolbar .icon-align-right::before { content: "⫸"; }

.lexical-toolbar .icon-align-justify {
  font-size: 16px;
  font-weight: 700;
}
.lexical-toolbar .icon-align-justify::before { content: "≡"; }

/* ── Insert ───────────────────────────────────── */
.lexical-toolbar .icon-link::before { content: "🔗"; }
.lexical-toolbar .icon-quote::before { content: "❝"; font-size: 18px; }
.lexical-toolbar .icon-spoiler::before { content: "⚠"; }
.lexical-toolbar .icon-image::before { content: "🖼"; }
.lexical-toolbar .icon-table::before { content: "⊞"; font-size: 18px; font-weight: 700; }
.lexical-toolbar .icon-horizontal::before,
.lexical-toolbar .icon-scene::before { content: "—"; font-weight: 700; }
.lexical-toolbar .icon-callout::before { content: "💡"; }
.lexical-toolbar .icon-pull-quote::before { content: "❝"; font-size: 18px; }

/* ── History ──────────────────────────────────── */
.lexical-toolbar .icon-undo::before { content: "↩"; font-size: 16px; }
.lexical-toolbar .icon-redo::before { content: "↪"; font-size: 16px; }

/* ── More ─────────────────────────────────────── */
.lexical-toolbar .icon-emoji::before { content: "😊"; }
.lexical-toolbar .icon-code::before { content: "</>"; font-size: 12px; font-weight: 800; letter-spacing: -1px; }
.lexical-toolbar .icon-code-block::before { content: "{ }"; font-size: 12px; font-weight: 800; }
.lexical-toolbar .icon-highlight::before { content: "▰"; color: #facc15; font-size: 15px; }
.lexical-toolbar .icon-clear-formatting::before { content: "✕"; font-size: 14px; font-weight: 700; }

/* ============================================
   TOOLBAR DIVIDER — Refined
   ============================================ */
.lexical-toolbar .toolbar-divider {
  display: none;
}

.lexical-editor .text-size-small,
.post-body .text-size-small,
.discussion-post-body .text-size-small { font-size: .875em; }
.lexical-editor .text-size-large,
.post-body .text-size-large,
.discussion-post-body .text-size-large { font-size: 1.2em; }
.lexical-editor .text-size-xlarge,
.post-body .text-size-xlarge,
.discussion-post-body .text-size-xlarge { font-size: 1.45em; }

@media (max-width: 680px) {
  .lexical-toolbar { padding: 8px; }
  .lexical-toolbar .toolbar-group-label { padding:0 4px;font-size:9px; }
  .lexical-toolbar select { max-width: 104px; }
}

/* ============================================
   TOOLBAR DROPDOWN (More menu)
   ============================================ */
.lexical-toolbar .toolbar-more {
  position: relative;
  margin-left: auto;
}

/* The full studio toolbar is a compact command deck, not a horizontal rail. */
.lexical-toolbar.lexical-toolbar--publishing {
  position: relative;
  top: auto;
  flex-wrap: wrap;
  align-content: center;
  gap: 6px;
  overflow: visible;
  padding: 8px;
}

.lexical-toolbar.lexical-toolbar--publishing .toolbar-group {
  min-height: 36px;
  padding: 2px;
}

.lexical-toolbar.lexical-toolbar--publishing .toolbar-group-label {
  padding: 0 5px;
  font-size: 9px;
}

.lexical-toolbar.lexical-toolbar--publishing button {
  min-width: 32px;
  min-height: 32px;
  padding: 6px 8px;
}

.lexical-toolbar.lexical-toolbar--publishing select {
  min-height: 32px;
  max-width: 104px;
}

/* Release the toolbar's horizontal clipping while its menu is open. */
.lexical-toolbar.has-open-menu {
  overflow: visible;
  z-index: 100;
}

.lexical-toolbar .toolbar-more-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--lexical-surface);
  border: 1px solid var(--lexical-border);
  border-radius: var(--lexical-radius);
  padding: 8px;
  min-width: 180px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 101;
}

.lexical-toolbar .toolbar-more-dropdown.open {
  display: block;
}

.lexical-toolbar .toolbar-more-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 12px;
  background: transparent;
  color: var(--lexical-text-secondary);
  border: none;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
}

.lexical-toolbar .toolbar-more-dropdown button:hover {
  background: var(--lexical-purple-soft);
  color: var(--lexical-text);
}

/* ============================================
   HEADING SELECTOR — Refined
   ============================================ */
.lexical-toolbar select,
.lexical-toolbar .toolbar-heading-select {
  padding: 6px 24px 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
  color: #c0b0d0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  min-height: 34px;
  font-family: inherit;
  transition: all 0.18s ease;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23c0b0d0'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.lexical-toolbar select:hover,
.lexical-toolbar .toolbar-heading-select:hover {
  border-color: rgba(168, 85, 247, 0.4);
  background: rgba(168, 85, 247, 0.08);
  color: #d4b8f0;
}

.lexical-toolbar select:focus,
.lexical-toolbar .toolbar-heading-select:focus {
  border-color: #7C3AED;
  outline: none;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.lexical-toolbar select option,
.lexical-toolbar .toolbar-heading-select option {
  background: #1a1020;
  color: #f1f5f9;
}

/* ============================================
   EMOJI BUTTON — Subtle highlight
   ============================================ */
.lexical-toolbar button[data-command="emoji"] {
  background: rgba(124, 58, 237, 0.08);
  border-radius: 8px;
}

.lexical-toolbar button[data-command="emoji"]:hover {
  background: rgba(124, 58, 237, 0.20);
}

/* ============================================
   STATUS BAR
   ============================================ */
.lexical-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  border-top: 1px solid var(--lexical-border);
  font-size: 13px;
  color: var(--lexical-text-muted);
  background: rgba(26, 16, 32, 0.8);
  backdrop-filter: blur(8px);
  border-radius: 0 0 var(--lexical-radius) var(--lexical-radius);
}

.lexical-status .status-saved {
  color: #22c55e;
}

.lexical-status .status-saving {
  color: #F59E0B;
}

.lexical-status .status-offline {
  color: #EF4444;
}

.lexical-status .status-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lexical-status .status-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: #6c6078;
}

.lexical-status .word-count,
.lexical-status .reading-time {
  color: #a68fb8;
  font-weight: 500;
}

/* ============================================
   COMPACT COMPOSER
   ============================================ */
.lexical-compact .editor-input {
  min-height: 60px;
  padding: 12px 16px;
  font-size: 15px;
}

.lexical-compact .lexical-toolbar {
  padding: 6px 10px;
}

.lexical-compact .lexical-toolbar button {
  padding: 3px 6px;
  min-height: 28px;
  min-width: 28px;
  font-size: 12px;
}

/* ============================================
   PUBLISHING COMPOSER
   ============================================ */
.lexical-publishing .editor-input {
  min-height: 500px;
  padding: 40px 48px;
  font-size: 18px;
  line-height: 1.85;
  color: #f1f5f9;
  letter-spacing: 0.01em;
}

.lexical-publishing .editor-input h1 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 1rem;
  color: #f1f5f9;
  letter-spacing: -0.02em;
}

.lexical-publishing .editor-input h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: #f1f5f9;
}

.lexical-publishing .editor-input h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 2rem 0 0.75rem;
  color: #f1f5f9;
}

.lexical-publishing .editor-input h4 {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #a68fb8;
}

.lexical-publishing .editor-input p {
  margin: 0 0 1.25rem;
  color: #a68fb8;
  line-height: 1.85;
}

.lexical-publishing .editor-input blockquote {
  border-left: 4px solid #7C3AED;
  padding: 1rem 1.5rem;
  margin: 1.75rem 0;
  background: rgba(124, 58, 237, 0.08);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  font-size: 1.1rem;
  color: #f1f5f9;
}

.lexical-publishing .editor-input .pull-quote {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 300;
  padding: 1.5rem 2rem;
  margin: 2rem 0;
  text-align: center;
  color: #f1f5f9;
  line-height: 1.4;
  border-top: 2px solid #7C3AED;
  border-bottom: 2px solid #7C3AED;
}

.lexical-publishing .editor-input .callout {
  padding: 1.25rem 1.5rem;
  background: rgba(124, 58, 237, 0.08);
  border-radius: 14px;
  margin: 1.75rem 0;
  border-left: 4px solid #7C3AED;
  color: #a68fb8;
}

.lexical-publishing .editor-input .scene-divider {
  text-align: center;
  padding: 1.5rem 0;
  color: #6c6078;
  font-size: 1.5rem;
  letter-spacing: 0.5rem;
  opacity: 0.4;
  user-select: none;
}

.lexical-publishing .editor-input code {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.9em;
  color: #c084fc;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.lexical-publishing .editor-input pre {
  background: #0d0a12;
  color: #E5E7EB;
  padding: 1.25rem 1.5rem;
  border-radius: 14px;
  overflow-x: auto;
  margin: 1.75rem 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.lexical-publishing .editor-input img {
  max-width: 100%;
  border-radius: 14px;
  margin: 1.75rem 0;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

/* ============================================
   IMAGES
   ============================================ */
.lexical-editor .editor-image {
  margin: 16px 0;
  border-radius: var(--lexical-radius);
  overflow: hidden;
  position: relative;
}

.lexical-editor .editor-image img {
  width: 100%;
  height: auto;
  display: block;
}

.lexical-editor .editor-image .image-caption {
  display: block;
  min-height: 2.4rem;
  padding: 8px 16px;
  font-size: 14px;
  color: var(--lexical-text-secondary);
  text-align: center;
  background: rgba(0, 0, 0, 0.02);
}

.lexical-editor .editor-image .image-caption:empty::before {
  content: attr(data-placeholder);
  color: var(--lexical-text-muted);
}

/* ============================================
   TABLES
   ============================================ */
.lexical-editor table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 15px;
}

.lexical-editor table th,
.lexical-editor table td {
  border: 1px solid var(--lexical-border);
  padding: 8px 12px;
  text-align: left;
}

.lexical-editor table th {
  background: var(--lexical-purple-soft);
  font-weight: 600;
  color: var(--lexical-text);
}

.lexical-editor table tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

/* ============================================
   LISTS
   ============================================ */
.lexical-editor ul,
.lexical-editor ol {
  padding-left: 24px;
  margin: 8px 0;
}

.lexical-editor ul {
  list-style-type: disc;
}

.lexical-editor ol {
  list-style-type: decimal;
}

.lexical-editor .checklist {
  list-style: none;
  padding-left: 0;
}

.lexical-editor .checklist li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
}

.lexical-editor .checklist li::before {
  content: "☐";
  font-size: 18px;
  flex-shrink: 0;
}

.lexical-editor .checklist li.checked::before {
  content: "☑";
  color: var(--lexical-purple);
}

/* ============================================
   SPOILER
   ============================================ */
.lexical-editor .spoiler {
  background: #1A1A1A;
  color: #1A1A1A;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.lexical-editor .spoiler:hover,
.lexical-editor .spoiler:focus {
  color: white;
}

/* ============================================
   CODE
   ============================================ */
.lexical-editor code {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.9em;
  color: var(--lexical-text-secondary);
}

.lexical-editor pre {
  background: #0d0a12;
  color: #E5E7EB;
  padding: 16px 20px;
  border-radius: var(--lexical-radius);
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--lexical-border);
}

.lexical-editor pre code {
  background: transparent;
  padding: 0;
  color: #E5E7EB;
}

/* ============================================
   SLASH COMMAND MENU — Notion-style palette
   ============================================ */
.lexical-slash-menu {
  position: absolute;
  background: #1e1428;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 8px;
  min-width: 280px;
  max-height: 340px;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  z-index: 30;
  backdrop-filter: blur(12px);
}

.lexical-slash-menu .slash-search {
  padding: 8px 10px;
  margin: -8px -8px 8px -8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  top: -8px;
  background: #1e1428;
  border-radius: 14px 14px 0 0;
}

.lexical-slash-menu .slash-search-input {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  color: #f1f5f9;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}

.lexical-slash-menu .slash-search-input:focus {
  border-color: rgba(168, 85, 247, 0.5);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.1);
}

.lexical-slash-menu .slash-search-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.lexical-slash-menu .slash-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.25);
  padding: 8px 12px 4px;
}

.lexical-slash-menu .slash-item {
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #c0b0d0;
  transition: all 0.12s ease;
  font-size: 13px;
}

.lexical-slash-menu .slash-item:hover,
.lexical-slash-menu .slash-item.selected {
  background: rgba(168, 85, 247, 0.2);
  color: #f1f5f9;
}

.lexical-slash-menu .slash-item .slash-icon {
  font-size: 18px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  flex-shrink: 0;
}

.lexical-slash-menu .slash-item:hover .slash-icon,
.lexical-slash-menu .slash-item.selected .slash-icon {
  background: rgba(168, 85, 247, 0.25);
}

.lexical-slash-menu .slash-item .slash-label {
  font-weight: 500;
  color: #f1f5f9;
}

.lexical-slash-menu .slash-item .slash-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  margin-left: auto;
}

/* ============================================
   EMOJI PICKER
   ============================================ */
.emoji-picker {
  position: fixed !important;
  background: var(--lexical-surface, #1a1020) !important;
  border: 1px solid var(--lexical-border, rgba(255,255,255,0.06)) !important;
  border-radius: 12px !important;
  padding: 12px !important;
  display: grid !important;
  grid-template-columns: repeat(8, 1fr) !important;
  gap: 4px !important;
  z-index: 1000 !important;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5) !important;
  max-width: 360px !important;
  max-height: 300px !important;
  overflow-y: auto !important;
  min-width: 280px !important;
}

.emoji-picker::-webkit-scrollbar {
  width: 4px;
}

.emoji-picker::-webkit-scrollbar-track {
  background: transparent;
}

.emoji-picker::-webkit-scrollbar-thumb {
  background: var(--lexical-border, rgba(255,255,255,0.1));
  border-radius: 2px;
}

.emoji-picker button {
  background: transparent !important;
  border: none !important;
  font-size: 22px !important;
  padding: 6px !important;
  cursor: pointer !important;
  border-radius: 8px !important;
  transition: background 0.15s !important;
  width: 100% !important;
  aspect-ratio: 1 / 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.emoji-picker button:hover {
  background: var(--lexical-purple-soft, rgba(124,58,237,0.15)) !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .lexical-toolbar {
    padding: 6px 8px;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .lexical-toolbar button {
    padding: 3px 5px;
    min-height: 30px;
    min-width: 30px;
    font-size: 12px;
  }

  .lexical-editor .editor-input {
    padding: 14px 16px;
    font-size: 16px;
  }

  .lexical-publishing .editor-input {
    padding: 20px;
    font-size: 17px;
  }

  .lexical-publishing .editor-input h1 {
    font-size: 28px;
  }

  .lexical-publishing .editor-input h2 {
    font-size: 22px;
  }

  .lexical-toolbar .desktop-only {
    display: none;
  }

  .lexical-status {
    flex-wrap: wrap;
    gap: 4px;
    font-size: 12px;
    padding: 6px 12px;
  }

  .lexical-status .status-right {
    gap: 8px;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .lexical-toolbar button {
    padding: 2px 4px;
    min-height: 28px;
    min-width: 28px;
    font-size: 11px;
  }

  .lexical-editor .editor-input {
    padding: 12px;
    font-size: 15px;
  }

  .lexical-publishing .editor-input {
    padding: 16px;
    font-size: 16px;
  }

  .lexical-publishing .editor-input h1 {
    font-size: 24px;
  }

  .lexical-publishing .editor-input h2 {
    font-size: 20px;
  }

  .lexical-status .status-right {
    gap: 4px;
    font-size: 10px;
  }

  .emoji-picker {
    grid-template-columns: repeat(6, 1fr) !important;
    max-width: 280px !important;
    min-width: 240px !important;
    max-height: 250px !important;
  }
  .emoji-picker button {
    font-size: 18px !important;
    padding: 4px !important;
  }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes pulse-save {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.lexical-status .saving {
  animation: pulse-save 1.5s ease-in-out infinite;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
.lexical-editor .editor-input::-webkit-scrollbar {
  width: 6px;
}

.lexical-editor .editor-input::-webkit-scrollbar-track {
  background: transparent;
}

.lexical-editor .editor-input::-webkit-scrollbar-thumb {
  background: var(--lexical-border);
  border-radius: 3px;
}

.lexical-editor .editor-input::-webkit-scrollbar-thumb:hover {
  background: var(--lexical-border-hover);
}

/* ============================================
   LIGHT MODE SUPPORT
   ============================================ */
:root.site-light .lexical-editor {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
}

:root.site-light .lexical-toolbar {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

:root.site-light .lexical-toolbar button {
  background: rgba(0, 0, 0, 0.03);
  color: #6b5a7a;
}

:root.site-light .lexical-toolbar button:hover {
  background: rgba(124, 58, 237, 0.12);
  color: #5b21b6;
}

:root.site-light .lexical-toolbar button.active {
  background: rgba(124, 58, 237, 0.18);
  color: #7c3aed;
  box-shadow: 0 0 0 1.5px rgba(124, 58, 237, 0.4);
}

/* List icons — dark purple for light mode */
:root.site-light .lexical-toolbar .icon-list,
:root.site-light .lexical-toolbar .icon-list-numbered,
:root.site-light .lexical-toolbar .icon-checklist {
  color: #7c3aed !important;
}

:root.site-light .lexical-toolbar .toolbar-divider {
  background: rgba(0, 0, 0, 0.1);
}

:root.site-light .lexical-toolbar select,
:root.site-light .lexical-toolbar .toolbar-heading-select {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.1);
  color: #6b5a7a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b5a7a'/%3E%3C/svg%3E");
}

:root.site-light .lexical-toolbar select:hover,
:root.site-light .lexical-toolbar .toolbar-heading-select:hover {
  border-color: rgba(124, 58, 237, 0.3);
  background: rgba(124, 58, 237, 0.06);
  color: #5b21b6;
}

:root.site-light .lexical-toolbar select option,
:root.site-light .lexical-toolbar .toolbar-heading-select option {
  background: #ffffff;
  color: #1a1020;
}

:root.site-light .lexical-editor .editor-input {
  color: #1a1020;
}

:root.site-light .lexical-status {
  background: rgba(255, 255, 255, 0.8);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  color: #8a7c9a;
}

:root.site-light .lexical-status .word-count,
:root.site-light .lexical-status .reading-time {
  color: #5c4a6e;
}

:root.site-light .lexical-slash-menu {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
}

:root.site-light .lexical-slash-menu .slash-search {
  background: #ffffff;
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

:root.site-light .lexical-slash-menu .slash-search-input {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
  color: #1a1020;
}

:root.site-light .lexical-slash-menu .slash-item {
  color: #6b5a7a;
}

:root.site-light .lexical-slash-menu .slash-item:hover,
:root.site-light .lexical-slash-menu .slash-item.selected {
  background: rgba(124, 58, 237, 0.1);
  color: #1a1020;
}

:root.site-light .lexical-slash-menu .slash-item .slash-icon {
  background: rgba(0, 0, 0, 0.03);
}

:root.site-light .lexical-slash-menu .slash-section-label {
  color: rgba(0, 0, 0, 0.3);
}

:root.site-light .lexical-slash-menu .slash-item .slash-desc {
  color: rgba(0, 0, 0, 0.35);
}

:root.site-light .emoji-picker {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

:root.site-light .lexical-publishing .editor-input {
  color: #1a1020;
}

:root.site-light .lexical-publishing .editor-input h1,
:root.site-light .lexical-publishing .editor-input h2,
:root.site-light .lexical-publishing .editor-input h3 {
  color: #1a1020;
}

:root.site-light .lexical-publishing .editor-input h4 {
  color: #5c4a6e;
}

:root.site-light .lexical-publishing .editor-input p {
  color: #5c4a6e;
}

:root.site-light .lexical-publishing .editor-input blockquote {
  color: #1a1020;
  background: rgba(124, 58, 237, 0.06);
}

:root.site-light .lexical-publishing .editor-input .pull-quote {
  color: #1a1020;
  border-top-color: #7C3AED;
  border-bottom-color: #7C3AED;
}

:root.site-light .lexical-publishing .editor-input .callout {
  background: rgba(124, 58, 237, 0.06);
  color: #5c4a6e;
}

/* ================================================================
   SUBMIT PAGE OVERRIDES — Editorial Studio Canvas (FINAL)
   ================================================================ */

/* 1. The editor wrapper — transparent, no box */
#lexical-editor-body .lexical-editor {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* 2. Toolbar — Centered pill above the canvas, sticky */
#lexical-editor-body .lexical-toolbar {
  background: var(--blog-surface) !important;
  border: 1px solid var(--blog-border) !important;
  border-radius: 12px !important;
  padding: 6px 12px !important;
  margin: 0 auto 20px auto !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2) !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: visible !important;
  position: relative !important;
  top: auto !important;
  z-index: 40 !important;
}

#lexical-editor-body .lexical-toolbar button {
  background: rgba(255, 255, 255, 0.04) !important;
  border-radius: 7px !important;
  color: #c0b0d0 !important;
  padding: 7px 10px !important;
  min-height: 34px !important;
  min-width: 34px !important;
  transition: all 0.18s ease !important;
  border: none !important;
  font-weight: 500 !important;
}

#lexical-editor-body .lexical-toolbar button:hover {
  background: rgba(168, 85, 247, 0.2) !important;
  color: #d4b8f0 !important;
  transform: translateY(-1px) !important;
}

#lexical-editor-body .lexical-toolbar button.active {
  background: rgba(168, 85, 247, 0.28) !important;
  color: #c084fc !important;
  box-shadow: 0 0 0 1.5px rgba(168, 85, 247, 0.5) !important;
}

/* List buttons — keep purple highlight */
#lexical-editor-body .lexical-toolbar .icon-list,
#lexical-editor-body .lexical-toolbar .icon-list-numbered,
#lexical-editor-body .lexical-toolbar .icon-checklist {
  color: #c084fc !important;
}

/* Light mode overrides for submit page */
:root.site-light #lexical-editor-body .lexical-toolbar button {
  background: rgba(0, 0, 0, 0.03) !important;
  color: #6b5a7a !important;
}

:root.site-light #lexical-editor-body .lexical-toolbar button:hover {
  background: rgba(124, 58, 237, 0.12) !important;
  color: #5b21b6 !important;
}

:root.site-light #lexical-editor-body .lexical-toolbar button.active {
  background: rgba(124, 58, 237, 0.18) !important;
  color: #7c3aed !important;
  box-shadow: 0 0 0 1.5px rgba(124, 58, 237, 0.4) !important;
}

:root.site-light #lexical-editor-body .lexical-toolbar .icon-list,
:root.site-light #lexical-editor-body .lexical-toolbar .icon-list-numbered,
:root.site-light #lexical-editor-body .lexical-toolbar .icon-checklist {
  color: #7c3aed !important;
}

#lexical-editor-body .lexical-toolbar select {
  background: transparent !important;
  border: 1px solid var(--blog-border) !important;
  color: var(--blog-text-secondary) !important;
  border-radius: 6px !important;
  padding: 6px 8px !important;
  font-size: 12px !important;
  min-height: 32px !important;
}

#lexical-editor-body .lexical-toolbar .toolbar-divider {
  height: 20px !important;
  margin: 0 6px !important;
  background: var(--blog-border) !important;
}

/* 3. Editor Canvas — Premium paper-like surface */
#lexical-editor-body .editor-input {
  background: var(--blog-surface) !important;
  border: 1px solid var(--blog-border) !important;
  border-radius: 16px !important;
  padding: 48px 56px !important;
  min-height: 650px !important;
  width: min(100%, 820px) !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  white-space: pre-wrap !important;
  margin: 0 auto !important;

  box-shadow:
    inset 0 2px 4px rgba(255,255,255,0.02),
    0 8px 32px rgba(0,0,0,0.3) !important;

  color: var(--blog-text) !important;
  font-size: 1.1rem !important;
  line-height: 1.85 !important;
  font-family: var(--blog-font-body) !important;
}

#lexical-editor-body .editor-input:focus {
  outline: none !important;
  border-color: var(--blog-primary) !important;
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,0.02),
    0 8px 32px rgba(0,0,0,0.3),
    0 0 0 3px var(--blog-primary-glow) !important;
}

#lexical-editor-body .editor-input::before {
  color: var(--blog-text-muted) !important;
  opacity: 0.3 !important;
  font-size: 1.1rem !important;
}

/* 4. Editorial Typography inside the canvas */
#lexical-editor-body .editor-input h1 {
  font-family: var(--blog-font-display) !important;
  font-size: 2.4rem !important;
  font-weight: 700 !important;
  line-height: 1.1 !important;
  margin: 0 0 1.5rem !important;
  color: var(--blog-text) !important;
  letter-spacing: -0.02em !important;
}

#lexical-editor-body .editor-input h2 {
  font-family: var(--blog-font-display) !important;
  font-size: 1.7rem !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  color: var(--blog-text) !important;
  margin: 2.5rem 0 1rem !important;
  padding-bottom: 0.4rem !important;
  border-bottom: 1px solid var(--blog-border) !important;
}

#lexical-editor-body .editor-input h3 {
  font-family: var(--blog-font-display) !important;
  font-size: 1.35rem !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
  color: var(--blog-text) !important;
  margin: 2rem 0 0.75rem !important;
}

#lexical-editor-body .editor-input h4 {
  font-family: var(--blog-font-body) !important;
  font-size: 1.05rem !important;
  font-weight: 600 !important;
  color: var(--blog-text-secondary) !important;
  margin: 1.5rem 0 0.5rem !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
}

#lexical-editor-body .editor-input p {
  font-size: 1.05rem !important;
  line-height: 1.85 !important;
  color: var(--blog-text-secondary) !important;
  margin: 0 0 1.25rem !important;
}

#lexical-editor-body .editor-input blockquote {
  border-left: 4px solid var(--blog-primary) !important;
  padding: 0.5rem 0 0.5rem 1.5rem !important;
  margin: 1.75rem 0 !important;
  font-style: italic !important;
  font-size: 1.1rem !important;
  color: var(--blog-text) !important;
}

#lexical-editor-body .editor-input code {
  background: rgba(255, 255, 255, 0.06) !important;
  padding: 2px 8px !important;
  border-radius: 4px !important;
  font-family: 'SF Mono', 'Fira Code', monospace !important;
  font-size: 0.9em !important;
  color: #c084fc !important;
}

#lexical-editor-body .editor-input pre {
  background: #0d0a12 !important;
  padding: 1.25rem 1.5rem !important;
  border-radius: 14px !important;
  overflow-x: auto !important;
  margin: 1.75rem 0 !important;
  border: 1px solid var(--blog-border) !important;
}

/* 5. Hide the status bar */
#lexical-editor-body .lexical-status {
  display: none !important;
}

/* 6. Light mode overrides */
:root.site-light #lexical-editor-body .editor-input {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,1),
    0 8px 24px rgba(0, 0, 0, 0.06) !important;
}

:root.site-light #lexical-editor-body .lexical-toolbar {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06) !important;
}

:root.site-light .submit-actions {
  background: rgba(250, 248, 246, 0.95);
  border-color: var(--blog-border);
  box-shadow: 0 4px 20px rgba(140, 90, 80, 0.06);
}

/* 7. Mobile */
@media (max-width: 1024px) {
  #lexical-editor-body .editor-input {
    padding: 24px !important;
    min-height: 400px !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  #lexical-editor-body .lexical-toolbar {
    position: relative !important;
    top: auto !important;
    padding: 6px 8px !important;
    width: 100% !important;
    border-radius: 12px !important;
    justify-content: flex-start !important;
    overflow: visible !important;
    flex-wrap: wrap !important;
  }
}

/* ================================================================
   DISCUSSION COMPOSER — compact, wrapping and contained
   The Blog studio and Forum composer share a mount id, so discussion
   profile rules explicitly restore the compact forum presentation.
   ================================================================ */
#lexical-editor-body[data-profile="discussion"] {
  width: 100%;
  min-width: 0;
}

#lexical-editor-body[data-profile="discussion"] .lexical-editor {
  overflow: hidden !important;
  border: 1px solid var(--forum-border, var(--lexical-border)) !important;
  border-top: 0 !important;
  border-radius: 0 0 12px 12px !important;
  background: rgba(7, 4, 10, .2) !important;
  box-shadow: none !important;
}

#lexical-editor-body[data-profile="discussion"] .lexical-toolbar {
  position: static !important;
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: flex-start !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 8px !important;
  gap: 6px !important;
  overflow: visible !important;
  border: 1px solid var(--forum-border, var(--lexical-border)) !important;
  border-radius: 12px 12px 0 0 !important;
  background: rgba(255, 255, 255, .018) !important;
  box-shadow: none !important;
}

#lexical-editor-body[data-profile="discussion"] .toolbar-group {
  min-height: 36px;
  padding: 2px;
  gap: 1px;
  flex: 0 1 auto;
  border-color: var(--forum-border, var(--lexical-border));
  background: rgba(255, 255, 255, .018);
}

#lexical-editor-body[data-profile="discussion"] .toolbar-group-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#lexical-editor-body[data-profile="discussion"] .lexical-toolbar button {
  min-width: 32px !important;
  min-height: 32px !important;
  padding: 5px 8px !important;
  color: var(--forum-text-secondary, #c0b0d0) !important;
  background: transparent !important;
}

#lexical-editor-body[data-profile="discussion"] .lexical-toolbar button:hover {
  color: var(--forum-text, #f1f5f9) !important;
  background: var(--forum-primary-glow, rgba(168, 85, 247, .14)) !important;
  transform: none !important;
}

#lexical-editor-body[data-profile="discussion"] .editor-input {
  width: 100% !important;
  max-width: 100% !important;
  min-height: 220px !important;
  margin: 0 !important;
  padding: 22px 24px !important;
  overflow-x: hidden !important;
  border: 0 !important;
  border-radius: 0 !important;
  color: var(--forum-text, var(--lexical-text)) !important;
  background: transparent !important;
  box-shadow: none !important;
  font-family: var(--forum-font-body, inherit) !important;
  font-size: 1rem !important;
  line-height: 1.7 !important;
}

#lexical-editor-body[data-profile="discussion"] .editor-input:focus {
  outline: none !important;
  box-shadow: inset 3px 0 0 var(--forum-primary, var(--lexical-purple)) !important;
}

#lexical-editor-body[data-profile="discussion"] .lexical-status {
  display: flex !important;
  padding: 8px 12px;
  border-radius: 0;
  background: rgba(255, 255, 255, .015);
  font-size: 11px;
}

:root.site-light #lexical-editor-body[data-profile="discussion"] .lexical-editor,
:root.site-light #lexical-editor-body[data-profile="discussion"] .lexical-toolbar,
:root.site-light #lexical-editor-body[data-profile="discussion"] .lexical-status {
  background: var(--forum-surface, #fff) !important;
}

:root.site-light #lexical-editor-body[data-profile="discussion"] .editor-input {
  color: var(--forum-text, #211827) !important;
  background: var(--forum-surface, #fff) !important;
}

@media (max-width: 600px) {
  #lexical-editor-body[data-profile="discussion"] .lexical-toolbar { gap: 4px !important; }
  #lexical-editor-body[data-profile="discussion"] .toolbar-group { border: 0; padding: 0; }
  #lexical-editor-body[data-profile="discussion"] .editor-input { min-height: 190px !important; padding: 18px !important; }
}

/* Persisted rich-text elements; these classes are also used on rendered posts. */
.lexical-editor mark,
.post-body mark,
.conversation-op-body mark,
.conversation-reply-body mark {
  padding: 0 0.15em;
  color: inherit;
  background: rgba(250, 204, 21, 0.35);
}

.editor-callout {
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  border-left: 3px solid #c084fc;
  background: rgba(192, 132, 252, 0.08);
}

.editor-pull-quote {
  margin: 1.25rem 0;
  padding: 0.75rem 1.25rem;
  border-left: 3px solid #e94560;
  font-size: 1.15em;
}

.editor-spoiler {
  margin: 0.75rem 0;
  padding: 0.6rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

.editor-spoiler summary { cursor: pointer; font-weight: 600; }

.lexical-editor pre,
.post-body pre,
.conversation-op-body pre,
.conversation-reply-body pre {
  overflow-x: auto;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
  white-space: pre-wrap;
}

.lexical-editor table,
.post-body table,
.conversation-op-body table,
.conversation-reply-body table {
  width: 100%;
  margin: 1rem 0;
  border-collapse: collapse;
}

.lexical-editor th, .lexical-editor td,
.post-body th, .post-body td,
.conversation-op-body th, .conversation-op-body td,
.conversation-reply-body th, .conversation-reply-body td {
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-align: left;
}

.text-align-left { text-align: left; }
.text-align-center { text-align: center; }
.text-align-right { text-align: right; }
.text-align-justify { text-align: justify; }
.lexical-source-field {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/*
 * Publishing toolbar contract: the studio markup owns this profile before
 * JavaScript runs, so this remains reliable with cached editor scripts and at
 * every breakpoint. Commands flow onto another row; they never create a
 * sideways toolbar rail.
 */
#lexical-editor-body[data-profile="publishing"] .lexical-toolbar {
  display: flex !important;
  flex-wrap: wrap !important;
  align-content: center !important;
  overflow: visible !important;
  position: relative !important;
  top: auto !important;
  width: 100% !important;
  max-width: 100% !important;
}

#lexical-editor-body[data-profile="publishing"] .toolbar-group {
  flex: 0 1 auto;
}

/* Publishing uses a quiet command strip instead of a row of nested boxes. */
#lexical-editor-body[data-profile="publishing"] .lexical-toolbar {
  gap: 4px !important;
  padding: 7px 8px !important;
}

#lexical-editor-body[data-profile="publishing"] .toolbar-group {
  min-height: 34px;
  gap: 2px;
  padding: 0 5px 0 0;
  border: 0;
  border-right: 1px solid var(--lexical-border);
  border-radius: 0;
  background: transparent;
}

#lexical-editor-body[data-profile="publishing"] .toolbar-group:last-child { border-right: 0; }
#lexical-editor-body[data-profile="publishing"] .toolbar-group-label { display: none; }
#lexical-editor-body[data-profile="publishing"] .toolbar-more { margin-left: 0; }
#lexical-editor-body[data-profile="publishing"] .lexical-toolbar button {
  min-width: 34px;
  min-height: 34px;
  padding: 6px 8px;
}

@media (max-width: 768px) {
  .lexical-toolbar,
  #lexical-editor-body[data-profile="publishing"] .lexical-toolbar {
    flex-wrap: wrap !important;
    overflow: visible !important;
    scrollbar-width: none;
  }
  .lexical-toolbar .toolbar-group { flex: 0 1 auto; min-width: 0; }
  .lexical-toolbar .toolbar-group-label { display: none; }
  .lexical-toolbar .toolbar-more { margin-left: 0; }
  .lexical-toolbar button { min-width: 36px; min-height: 36px; }
  .lexical-toolbar .toolbar-more-dropdown {
    position: fixed;
    inset: auto 12px calc(68px + env(safe-area-inset-bottom)) 12px;
    width: auto;
    max-height: min(360px, 55dvh);
    overflow-y: auto;
  }
  .lexical-slash-menu { width: min(320px, calc(100vw - 32px)); min-width: 0; }
}

/* Publishing surface: restrained controls, readable measure, contextual tools. */
#lexical-editor-body[data-profile="publishing"] .lexical-editor {
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 14px;
  background: color-mix(in srgb, var(--lexical-bg, #11131d) 74%, transparent);
}

#lexical-editor-body[data-profile="publishing"] .lexical-toolbar {
  position: sticky !important;
  z-index: 12;
  top: 0 !important;
  justify-content: center;
  border-bottom: 1px solid rgba(148, 163, 184, .13);
  background: color-mix(in srgb, var(--lexical-bg, #11131d) 94%, transparent);
  backdrop-filter: blur(14px);
}

#lexical-editor-body[data-profile="publishing"] .editor-input {
  box-sizing: border-box;
  width: min(100%, 75ch);
  min-height: 320px !important;
  margin: 0 auto;
  padding: clamp(34px, 6vw, 74px) clamp(22px, 6vw, 72px) 100px !important;
  color: var(--lexical-text, #ece9e5);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(17px, 1.55vw, 19px) !important;
  line-height: 1.78 !important;
}

.toolbar-dropdown { position: relative; display: flex; align-items: center; }
#lexical-editor-body .toolbar-dropdown-toggle { width: auto; padding-inline: 11px; font-size: .75rem; font-weight: 680; }
.toolbar-dropdown-toggle::after { margin-left: 6px; content: '⌄'; color: var(--lexical-text-muted); }
.toolbar-dropdown-menu { position: absolute; z-index: 40; top: calc(100% + 8px); left: 0; display: none; width: 220px; padding: 6px; border: 1px solid var(--lexical-border); border-radius: 10px; background: var(--lexical-toolbar-bg, #171a25); box-shadow: 0 18px 50px rgba(0,0,0,.42); }
.toolbar-dropdown-menu.open { display: grid; }
#lexical-editor-body .toolbar-dropdown-menu button { display: grid; grid-template-columns: 28px 1fr; gap: 7px; align-items: center; width: 100%; min-height: 38px; padding: 7px 9px; text-align: left; }

.lexical-selection-toolbar {
  position: fixed;
  z-index: 180;
  display: flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid rgba(148,163,184,.22);
  border-radius: 9px;
  background: #1b1e2b;
  box-shadow: 0 12px 36px rgba(0,0,0,.42);
  transform: translate(-50%, -100%);
}
.lexical-selection-toolbar[hidden] { display: none; }
.lexical-selection-toolbar button { width: 34px; height: 34px; border: 0; border-radius: 6px; background: transparent; color: #f3f1ed; cursor: pointer; }
.lexical-selection-toolbar button:hover { background: rgba(167,139,250,.16); }
#lexical-editor-body[data-profile="publishing"] button:focus-visible,
#lexical-editor-body[data-profile="publishing"] select:focus-visible,
.lexical-selection-toolbar button:focus-visible { outline: 2px solid #c4a7ff; outline-offset: 2px; }

@media (max-width: 768px) {
  #lexical-editor-body[data-profile="publishing"] .lexical-toolbar { justify-content: flex-start; }
  #lexical-editor-body[data-profile="publishing"] .editor-input { width: 100%; min-height: 280px !important; padding: 30px 20px 72px !important; }
  .toolbar-dropdown-menu { position: fixed; inset: auto 12px 82px; width: auto; max-height: 55dvh; overflow-y: auto; }
}

/* Contextual authoring layers share one visual and stacking contract. */
:root {
  --lexical-popover-bg: #1b1e2b;
  --lexical-popover-border: rgba(148, 163, 184, .24);
  --lexical-popover-text: #f3f1ed;
  --lexical-popover-muted: #aaa2b4;
  --lexical-popover-hover: rgba(167, 139, 250, .16);
  --lexical-popover-active: rgba(167, 139, 250, .28);
  --lexical-popover-shadow: 0 18px 52px rgba(0, 0, 0, .48);
  --lexical-focus-ring: #c4a7ff;
  --lexical-danger: #fb7185;
  --lexical-layer-toolbar: 20;
  --lexical-layer-context: 70;
}

:root.site-light {
  --lexical-popover-bg: #fffdfb;
  --lexical-popover-border: rgba(76, 55, 89, .18);
  --lexical-popover-text: #241a2c;
  --lexical-popover-muted: #75677e;
  --lexical-popover-hover: rgba(124, 58, 237, .1);
  --lexical-popover-active: rgba(124, 58, 237, .16);
  --lexical-popover-shadow: 0 18px 52px rgba(48, 35, 56, .18);
  --lexical-focus-ring: #7c3aed;
}

#lexical-editor-body[data-profile="publishing"] .lexical-editor { overflow: visible; }
#lexical-editor-body[data-profile="publishing"] .lexical-toolbar { z-index: var(--lexical-layer-toolbar) !important; }
.toolbar-dropdown-menu { z-index: var(--lexical-layer-context); }

.lexical-popover,
.lexical-selection-toolbar,
.lexical-slash-menu,
.emoji-picker {
  position: fixed;
  z-index: var(--lexical-layer-context) !important;
  box-sizing: border-box;
  color: var(--lexical-popover-text);
  border: 1px solid var(--lexical-popover-border);
  background: var(--lexical-popover-bg) !important;
  box-shadow: var(--lexical-popover-shadow);
}

.lexical-popover[hidden],
.lexical-selection-toolbar[hidden] { display: none !important; }

.lexical-selection-toolbar {
  top: auto;
  transform: translateX(-50%);
}

.lexical-selection-toolbar button.active,
.lexical-selection-toolbar button[aria-pressed="true"] {
  color: #d8b4fe;
  background: var(--lexical-popover-active);
}

.lexical-selection-toolbar [class^="icon-"] {
  display: inline-flex;
  min-width: 18px;
  min-height: 18px;
  align-items: center;
  justify-content: center;
  color: inherit;
  font-style: normal;
}
.lexical-selection-toolbar .icon-bold::before { content: "B"; font-weight: 800; }
.lexical-selection-toolbar .icon-italic::before { content: "I"; font-style: italic; }
.lexical-selection-toolbar .icon-underline::before { content: "U"; text-decoration: underline; text-underline-offset: 3px; }
.lexical-selection-toolbar .icon-link::before { content: "↗"; }
.lexical-selection-toolbar .icon-quote::before { content: "❝"; font-size: 18px; }

.lexical-popover button,
.lexical-popover input,
.lexical-slash-menu button { font: inherit; }
.lexical-popover button:focus-visible,
.lexical-popover input:focus-visible,
.lexical-slash-menu button:focus-visible {
  outline: 2px solid var(--lexical-focus-ring);
  outline-offset: 2px;
}

.lexical-link-popover {
  width: min(360px, calc(100vw - 24px));
  padding: 14px;
  border-radius: 12px;
}
.lexical-link-popover label {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
  color: var(--lexical-popover-muted);
  font-size: 12px;
  font-weight: 700;
}
.lexical-link-popover input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 10px;
  color: var(--lexical-popover-text);
  border: 1px solid var(--lexical-popover-border);
  border-radius: 7px;
  background: color-mix(in srgb, var(--lexical-popover-bg) 90%, white 10%);
}
.lexical-popover-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 12px; }
.lexical-popover-actions button,
.table-toolbar-toggle,
.table-toolbar-menu button {
  min-height: 36px;
  padding: 7px 10px;
  color: var(--lexical-popover-text);
  border: 1px solid var(--lexical-popover-border);
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}
.lexical-popover-actions button:hover,
.table-toolbar-toggle:hover,
.table-toolbar-menu button:hover { background: var(--lexical-popover-hover); }
.lexical-popover-actions .primary { background: var(--lexical-popover-active); }
.lexical-popover .danger { color: var(--lexical-danger); }
.lexical-popover-error { margin: 8px 0 0; color: var(--lexical-danger); font-size: 12px; }

.lexical-table-toolbar { padding: 5px; border-radius: 9px; }
.lexical-image-toolbar { display: flex; gap: 5px; padding: 5px; border-radius: 9px; }
.lexical-image-toolbar button { border: 0; border-radius: 6px; padding: 7px 9px; background: rgba(255,255,255,.07); color: inherit; cursor: pointer; }
.table-toolbar-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  width: 225px;
  padding: 6px;
  border: 1px solid var(--lexical-popover-border);
  border-radius: 9px;
  background: var(--lexical-popover-bg);
  box-shadow: var(--lexical-popover-shadow);
}
.table-toolbar-menu[hidden] { display: none; }
.table-toolbar-menu button { width: 100%; border: 0; text-align: left; }
.lexical-editor table { display: block; max-width: 100%; overflow-x: auto; }
.lexical-editor table td,
.lexical-editor table th { min-width: 110px; }
.lexical-editor table.is-active-table { outline: 2px solid rgba(167, 139, 250, .42); outline-offset: 2px; }
.lexical-editor table .is-active-cell { box-shadow: inset 0 0 0 2px var(--lexical-focus-ring); }

.lexical-slash-menu { position: fixed; z-index: var(--lexical-layer-context); }
.lexical-slash-menu .slash-item {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
}

@media (max-width: 560px) {
  .lexical-selection-toolbar { max-width: calc(100vw - 24px); }
  .lexical-table-toolbar { max-width: calc(100vw - 24px); }
  .table-toolbar-menu { position: fixed; inset: auto 12px 72px; width: auto; max-height: 55dvh; overflow-y: auto; }
}
