
:where(lexxy-editor) {
  --lexxy-editor-padding: 1ch;
  --lexxy-toolbar-gap: 2px;

  border: 0px solid #94a3b8;
  border-radius: calc(var(--lexxy-radius) + var(--lexxy-toolbar-gap));
  display: block;
  overflow: visible;
  position: relative;
  transition: opacity 150ms;

  input,
  button {
    &:focus-visible {
      outline-color: #d946ef;
    }
  }

  button,
  summary {
    -webkit-appearance: none;
    appearance: none;
    background: #0f172a;
    border: none;
    border-radius: var(--lexxy-radius);
    cursor: pointer;
    font-size: inherit;
    inline-size: auto;

    @media(any-hover: hover) {
      &:hover {
        filter: brightness(0.9);
      }
    }
  }

  .node--selected {
    &:has(img) img,
    &:not(:has(img)) {
      outline: var(--lexxy-focus-ring-size) solid #d946ef;
      outline-offset: var(--lexxy-focus-ring-offset);
    }
  }

  action-text-attachment {
    cursor: pointer;
  }

    color: #ffffff;

  h1, h2, h3, h4, h5, h6 {
    display: block;
    font-weight: bold;
    hyphens: auto;
    margin-block: 0 var(--lexxy-content-margin);
    overflow-wrap: break-word;
    text-wrap: balance;
  }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  h4 { font-size: 1rem; }
  h5 { font-size: 0.875rem; }
  h6 { font-size: 0.75rem; }

  p,
  ul,
  ol,
  dl,
  blockquote,
  figure,
  .attachment {
    margin-block: 0 var(--lexxy-content-margin);

    &:not(lexxy-editor &) {
      overflow-wrap: break-word;
      text-wrap: pretty;
    }
  }
}

/* Placeholder */
:where(.lexxy-editor--empty) {
  .lexxy-editor__content:not(:has(ul, ol))::before {
    content: attr(placeholder);
    color: #94a3b8;
    cursor: text;
    opacity: 0.66;
    pointer-events: none;
    position: absolute;
    white-space: pre-line;
  }
}

:where(.lexxy-editor__content) {
  min-block-size: 8lh;
  outline: 0;
  padding: var(--lexxy-editor-padding);
}

:where(.lexxy-editor--drag-over) {
  background-color: #1e293b;
  border-radius: var(--lexxy-radius);
  outline: 2px dashed #a21caf;
}

/* Toolbar */
/* -------------------------------------------------------------------------- */

:where(lexxy-toolbar) {
  --lexxy-toolbar-icon-size: 1em;

  border-block-end: 1px solid #94a3b8;
  color: #ffffff;
  display: flex;
  font-size: inherit;
  gap: var(--lexxy-toolbar-gap);
  max-inline-size: 100%;
  padding: 2px;
  position: relative;
}

:where(.lexxy-editor__toolbar-button) {
  aspect-ratio: 1;
  block-size: 2lh;
  color: #ffffff;
  display: grid;
  place-items: center;

  &:is(:active) {
    background-color: #1e293b;
  }

  &[aria-pressed="true"] {
    background-color: #1e293b;
  }

  svg {
    -webkit-touch-callout: none;
    block-size: var(--lexxy-toolbar-icon-size);
    fill: #ffffff;
    grid-area: 1/1;
    inline-size: var(--lexxy-toolbar-icon-size);
    user-select: none;
  }
}

:where(.lexxy-editor__toolbar-overflow) {
  display: none;
  position: relative;
  z-index: 1;

  summary {
    list-style: none;

    &::-webkit-details-marker {
      display: none;
    }

    [open] & {
      filter: brightness(0.9);
    }
  }
}

:where(.lexxy-editor__toolbar-overflow-menu) {
  background-color: #0f172a;
  border-radius: calc(var(--lexxy-radius) + var(--lexxy-toolbar-gap));
  box-shadow: var(--lexxy-shadow);
  display: flex;
  inset-inline-end: 0;
  padding: var(--lexxy-toolbar-gap);
  position: absolute;
}

/* Link dialog */
/* -------------------------------------------------------------------------- */

:where(.lexxy-link-dialog) {
  display: contents;

  dialog {
    background-color: #0f172a;
    border: 1px solid #94a3b8;
    border-radius: var(--lexxy-radius);
    box-shadow: var(--lexxy-shadow);
    color: #ffffff;
    padding: 1ch;
    position: absolute;
    z-index: 1;
  }

  .lexxy-dialog-actions {
    display: flex;
    font-size: var(--lexxy-text-small);
    flex: 1 1 0%;
    gap: 1ch;
    margin-block-start: 1ch;
  }

  input[type="url"],
  button {
    line-height: 1.5lh;
    padding-inline: 1ch;
  }

  input[type="url"] {
    border: 1px solid #94a3b8;
    border-radius: var(--lexxy-radius);
    min-inline-size: 30ch;
  }

  button {
    background-color: #1e293b;
    inline-size: 100%;
    justify-content: center;
  }

  button[type="submit"] {
    background-color: #c026d3;
    color: #ffffff;
  }
}

/* Language picker */
/* -------------------------------------------------------------------------- */

:where(.lexxy-code-language-picker) {
  -webkit-appearance: none;
  appearance: none;
  background-color: #0f172a;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m12 19.5c-.7 0-1.3-.3-1.7-.8l-9.8-11.1c-.7-.8-.6-1.9.2-2.6.8-.6 1.9-.6 2.5.2l8.6 9.8c0 .1.2.1.4 0l8.6-9.8c.7-.8 1.8-.9 2.6-.2s.9 1.8.2 2.6l-9.8 11.1c-.4.5-1.1.8-1.7.8z' fill='%23ffffff'/%3E%3C/svg%3E");
  background-position: center right 1ch;
  background-repeat: no-repeat;
  background-size: 1ch;
  block-size: 1.5lh;
  border: 1px solid #94a3b8;
  border-radius: 12px;
  color: #ffffff;
  font-family: var(--lexxy-font-base);
  font-size: var(--lexxy-text-small);
  font-weight: normal;
  inset-inline-end: var(--lexxy-editor-padding);
  margin: 0 0.5ch 0 -0.5ch;
  padding: 0 2ch 0 1ch;
  text-align: start;

  @media (prefers-color-scheme: dark) {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m12 19.5c-.7 0-1.3-.3-1.7-.8l-9.8-11.1c-.7-.8-.6-1.9.2-2.6.8-.6 1.9-.6 2.5.2l8.6 9.8c0 .1.2.1.4 0l8.6-9.8c.7-.8 1.8-.9 2.6-.2s.9 1.8.2 2.6l-9.8 11.1c-.4.5-1.1.8-1.7.8z' fill='%23ffffff'/%3E%3C/svg%3E");
  }
}

/* Prompt */
/* ------------------------------------------------------------------------ */

:where(.lexxy-prompt-menu) {
  --lexxy-prompt-avatar-size: 24px;
  --lexxy-prompt-min-width: 20ch;
  --lexxy-prompt-padding: 0.5ch;

  background-color: #0f172a;
  border-radius: calc(var(--lexxy-prompt-padding) * 2);
  box-shadow: var(--lexxy-shadow);
  color: #ffffff;
  font-family: var(--lexxy-font-base);
  font-size: var(--lexxy-text-small);
  list-style: none;
  margin: 0;
  max-block-size: 200px;
  min-inline-size: var(--lexxy-prompt-min-width);
  overflow: auto;
  padding: var(--lexxy-prompt-padding);
  visibility: hidden;
  z-index: var(--lexxy-z-popup);
}

:where(.lexxy-prompt-menu--visible) {
  visibility: initial;
}

:where(.lexxy-prompt-menu__item) {
  align-items: center;
  border-radius: var(--lexxy-radius);
  cursor: pointer;
  display: flex;
  gap: var(--lexxy-prompt-padding);
  padding: var(--lexxy-prompt-padding);
  white-space: nowrap;

  &:hover {
    background-color: #1e293b;
  }

  &[aria-selected] {
    background-color: #1e293b;
  }

  img {
    block-size: var(--lexxy-prompt-avatar-size);
    border-radius: 50%;
    flex-shrink: 0;
    inline-size: var(--lexxy-prompt-avatar-size);
    margin: 0;
  }

  + & {
    margin-top: 2px;
  }
}

:where(.lexxy-prompt-menu__item--empty) {
  color: #94a3b8;
  padding: var(--lexxy-prompt-padding);
}

/* Restore list styles, indents, and spacing */
.lexxy-editor__content ul,
#journal_content ul {
  list-style-type: disc;
  margin-top: 1em;
  margin-bottom: 1em;
  padding-left: 2em; /* Adjust if indent feels off; 40px or 2em is common default */
}

.lexxy-editor__content ol,
#journal_content ol {
  list-style-type: decimal;
  margin-top: 1em;
  margin-bottom: 1em;
  padding-left: 2em;
}

.lexxy-editor__content li,
#journal_content li {
  margin-bottom: 0.5em; /* Adds spacing between list items */
}

/* Restore heading styles (focus on h2 since your example uses it; add others as needed) */
.lexxy-editor__content h2,
#journal_content h2 {
  font-size: 1.5em; /* Or 24px/1.5rem for larger size */
  font-weight: bold;
  margin-top: 0.83em;
  margin-bottom: 0.83em;
}

/* Optional: Restore paragraph spacing if paragraphs feel too tight */
.lexxy-editor__content p,
#journal_content p {
  margin-bottom: 1em;
}

/* Optional: Ensure code blocks render properly (your HTML uses <code> as a block) */
.lexxy-editor__content code,
#journal_content code {
  display: block;
  padding: 0.5em;
  background-color: #334155; /* Light gray; adjust for dark mode if needed, e.g., #333 */
  border-radius: 4px;
  font-family: monospace;
  white-space: pre-wrap;
}

/* Optional: If links lose defaults, restore them */
.lexxy-editor__content a,
#journal_content a {
  color: #0000ee;
  text-decoration: underline;
}