.community-editor {
  min-width: 0;
  overflow: clip;
  border: 1px solid var(--pm-color-border);
  border-radius: var(--pm-radius-card);
  background: var(--pm-color-surface);
  color: var(--pm-color-text);
  font-family: var(--pm-font-family);
}

.community-editor-tools {
  background: var(--pm-color-page);
  border-bottom: 1px solid var(--pm-color-border);
}

.community-editor-tools-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 10px;
}

.community-editor-tools-row + .community-editor-tools-row {
  border-top: 1px solid var(--pm-color-border);
}

.community-editor-tools-row[hidden] {
  display: none;
}

.community-editor-insert-control {
  display: none;
}

.community-editor-tool,
.community-editor-select,
.community-editor-submit {
  min-height: 36px;
  min-width: 36px;
  padding-block: 5px;
  padding-inline: 9px var(--pm-select-padding-end, 9px);
  border: 1px solid transparent;
  border-radius: 8px;
  background-color: transparent;
  color: var(--pm-color-text);
  font: inherit;
  font-size: .875rem;
  font-weight: 650;
}

.community-editor-tool,
.community-editor-submit {
  cursor: pointer;
}

.community-editor-select {
  border-color: var(--pm-color-border);
  background-color: var(--pm-color-surface);
}

.community-editor-tool:hover,
.community-editor-tool[aria-pressed="true"] {
  border-color: var(--pm-color-border);
  background: var(--pm-color-blue-subtle);
  color: var(--pm-color-blue-hover);
}

.community-editor-tool:focus-visible,
.community-editor-select:focus-visible,
.community-editor-dialog :is(input, button):focus-visible {
  outline: 2px solid var(--pm-color-focus);
  outline-offset: 2px;
}

.community-editor-bold { font-weight: 800; }
.community-editor-italic { font-style: italic; }
.community-editor-underline { text-decoration: underline; }
.community-editor-strike { text-decoration: line-through; }

.community-editor-surface {
  min-height: clamp(240px, 36vw, 350px);
  padding: var(--pm-space-16);
}

.community-editor-surface:focus {
  outline: 2px solid var(--pm-color-focus);
  outline-offset: -2px;
}

.community-editor-surface:empty::before {
  color: var(--pm-color-text-secondary);
  content: attr(data-placeholder);
  pointer-events: none;
}

.community-editor-status {
  margin: 0;
  padding: 8px 16px;
  background: var(--pm-color-blue-subtle);
  color: var(--pm-color-blue-hover);
}

.community-editor-dialog {
  box-sizing: border-box;
  width: min(32rem, calc(100% - 32px));
  max-width: none;
  max-height: calc(100% - 32px);
  padding: clamp(16px, 4vw, 26px);
  border: 1px solid var(--pm-color-border);
  border-radius: var(--pm-radius-panel);
  background: var(--pm-color-surface);
  color: var(--pm-color-text);
  box-shadow: var(--pm-shadow-panel);
}

.community-editor-dialog::backdrop {
  background: rgb(8 30 74 / 55%);
}

.community-editor-dialog form,
.community-editor-dialog label {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.community-editor-dialog label {
  gap: 4px;
  font-weight: 650;
}

.community-editor-dialog h3 {
  margin: 0;
  font-size: 1.25rem;
}

.community-editor-dialog input {
  box-sizing: border-box;
  min-width: 0;
  min-height: var(--pm-target-min);
  padding: 8px 10px;
  border: 1px solid var(--pm-color-border);
  border-radius: var(--pm-radius-card);
  color: inherit;
  background: var(--pm-color-surface);
  font: inherit;
  font-weight: 400;
}

.community-editor-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.community-editor-dialog-actions .community-editor-tool {
  border-color: var(--pm-color-border);
}

.community-editor-submit {
  background: var(--pm-color-blue-hover);
  color: var(--pm-color-text-on-navy);
}

.community-editor-dialog :disabled,
.community-editor-tools :disabled {
  opacity: .58;
  cursor: default;
}

.community-editor-dialog-error {
  margin: 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: #fff1f1;
  color: #871d27;
}

.community-rich-body {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--pm-color-text);
  font-size: var(--pm-type-body);
  line-height: 1.7;
}

.community-rich-body :is(p, h2, h3, figure, blockquote, ul, ol, table, hr) {
  margin: 0 0 .8em;
}

.community-rich-body :is(p, h2, h3, figure, blockquote, ul, ol, table, hr):last-child {
  margin-bottom: 0;
}

.community-rich-body h2 { font-size: 1.4em; line-height: 1.32; }
.community-rich-body h3 { font-size: 1.2em; line-height: 1.4; }
.community-rich-body a { color: var(--pm-color-blue-hover); text-decoration: underline; }
.community-rich-body ul { padding-inline-start: 1.5em; list-style: disc; }
.community-rich-body ol { padding-inline-start: 1.5em; list-style: decimal; }
.community-rich-body figure img { display: block; }
.community-rich-body img { max-width: 100%; height: auto; border-radius: var(--pm-radius-card); }
.community-rich-body figcaption { margin-top: 5px; color: var(--pm-color-text-secondary); font-size: .9em; }

.community-rich-body blockquote {
  padding: 7px 14px;
  border-inline-start: 3px solid var(--pm-color-blue);
  color: var(--pm-color-text-secondary);
}

.community-rich-body hr {
  margin-block: 1.1em;
  border: 0;
  border-top: 1px solid var(--pm-color-border);
}

.community-rich-body table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.community-rich-body :is(td, th) {
  min-width: 5em;
  padding: 6px 9px;
  border: 1px solid var(--pm-color-border);
  background: var(--pm-color-surface);
  text-align: start;
  vertical-align: top;
}

.community-rich-body th {
  background: var(--pm-color-blue-subtle);
  font-weight: 700;
}

.community-rich-body .community-align-left { text-align: left; }
.community-rich-body .community-align-center { text-align: center; }
.community-rich-body .community-align-right { text-align: right; }
.community-rich-body .community-size-14 { font-size: 14px; }
.community-rich-body .community-size-16 { font-size: 16px; }
.community-rich-body .community-size-18 { font-size: 18px; }
.community-rich-body .community-size-20 { font-size: 20px; }
.community-rich-body .community-size-24 { font-size: 24px; }
.community-rich-body .community-size-28 { font-size: 28px; }
.community-editor-surface font[size="2"] { font-size: 14px; }
.community-editor-surface font[size="3"] { font-size: 16px; }
.community-editor-surface font[size="4"] { font-size: 18px; }
.community-editor-surface font[size="5"] { font-size: 20px; }
.community-editor-surface font[size="6"] { font-size: 24px; }
.community-editor-surface font[size="7"] { font-size: 28px; }
.community-rich-body .community-color-navy { color: var(--pm-color-text); }
.community-rich-body .community-color-blue { color: var(--pm-color-blue-hover); }
.community-rich-body .community-color-red { color: #a62535; }
.community-rich-body .community-color-green { color: #176446; }

@media (max-width: 620px) {
  .community-editor-insert-control {
    display: flex;
    padding-bottom: 1px;
  }

  .community-editor-insertion:not([data-expanded="true"]) {
    display: none;
  }

  .community-editor-insertion {
    border-top: 0;
  }

  .community-editor-insert-control .community-editor-tool {
    border-color: var(--pm-color-border);
    background: var(--pm-color-surface);
  }
}

@media (pointer: coarse) {
  .community-editor-tool,
  .community-editor-select,
  .community-editor-submit {
    min-height: var(--pm-target-min);
    min-width: var(--pm-target-min);
  }

  .community-editor-select,
  .community-editor-dialog input {
    font-size: 1rem;
  }
}
