/* The editor uses the site's palette and keeps its two columns independently scrollable. */
.fox-editor {
  width: min(1120px, calc(100vw - 48px));
  max-width: none;
  height: min(800px, calc(100dvh - 48px));
  max-height: none;
  padding: 0;
  margin: auto;
  border: 1px solid var(--r-border, #43334d);
  border-radius: 22px;
  background: var(--r-surface, #17121e);
  color: var(--r-text, #f3ebfc);
  box-shadow: 0 24px 100px #0007;
  text-align: left;
  overflow: hidden;
}
.fox-editor[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.fox-editor::backdrop { background: #100a18b5; }
body.fe-is-open { overflow: hidden; }
.fox-editor [hidden] { display: none !important; }
.fox-editor :is(h2, h3, h4, p) { margin: 0; }
.fox-editor :is(button, select, textarea) { font: inherit; color: inherit; }
.fox-editor button {
  min-height: 42px;
  padding: 8px 13px;
  border: 1px solid var(--r-border, #43334d);
  border-radius: 9px;
  background: var(--r-surface, #17121e);
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
}
.fox-editor button:disabled { opacity: .44; cursor: default; }
.fox-editor button:not(:disabled):hover { border-color: var(--r-accent, #be9cea); }
.fe-header, .fe-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
}
.fe-header { border-bottom: 1px solid var(--r-border, #43334d); }
.fe-brand, .fe-header-actions, .fe-footer-actions, .fe-tools, .fe-card-actions, .fe-filters {
  display: flex;
  align-items: center;
  gap: 8px;
}
.fe-brand { min-width: 0; gap: 2px; }
.fe-brand img { object-fit: contain; flex: none; }
.fe-brand h2 { font-size: clamp(20px, 2.5vw, 29px); line-height: 1.15; letter-spacing: -.035em; }
.fox-editor .fe-close { font-size: 27px; padding: 0; line-height: 1; width: 42px; }
.fe-workspace { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); min-height: 0; }
.fe-draft, .fe-review { padding: 22px; min-width: 0; }
.fe-draft { display: flex; flex-direction: column; min-height: 0; gap: 12px; }
.fe-draft-head, .fe-review-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.fe-draft-head label, .fe-review-head h3 { font-size: 20px; font-weight: 650; letter-spacing: -.025em; }
.fox-editor #fe-text, .fe-original {
  flex: 1;
  width: 100%;
  min-height: 120px;
  box-sizing: border-box;
  padding: 16px;
  background: var(--r-raised, #201829);
  border: 1px solid var(--r-border, #43334d);
  border-radius: 11px;
  font-size: 16px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  resize: none;
}
.fe-original { overflow: auto; white-space: pre-wrap; }
.fe-metrics, #fe-summary, #fe-local, #fe-status { font-size: 14px; color: var(--r-secondary, #bba8cd); line-height: 1.5; }
#fe-status:empty { display: none; }
.fe-review { background: var(--r-soft, #1d1424); border-left: 1px solid var(--r-border, #43334d); overflow: auto; overscroll-behavior: contain; }
.fe-review-head { align-items: flex-start; }
.fe-mode { display: grid; gap: 5px; font-size: 14px; }
.fox-editor select { max-width: 100%; padding: 8px; border: 1px solid var(--r-border, #43334d); border-radius: 8px; background: var(--r-surface, #17121e); font-size: 16px; }
.fe-filters, .fe-tools, .fe-card-actions, .fe-footer-actions { flex-wrap: wrap; }
.fe-filters { margin-top: 16px; }
.fox-editor button[aria-pressed="true"], .fox-editor .fe-apply { border-color: var(--r-accent, #be9cea); color: var(--r-accent, #be9cea); }
.fe-card, .fe-checklist, .fe-empty { padding: 15px; border: 1px solid var(--r-border, #43334d); border-radius: 12px; background: var(--r-surface, #17121e); overflow-wrap: anywhere; }
.fe-findings { display: grid; gap: 12px; margin-block: 16px 3px; }
.fe-card h4, .fe-checklist h4, .fe-empty h4 { font-size: 17px; line-height: 1.4; font-weight: 650; }
.fe-card .fe-card-label { margin-bottom: 4px; font-size: 13px; color: var(--r-secondary, #bba8cd); }
.fe-card .fe-excerpt { margin-top: 9px; white-space: pre-wrap; font-size: 15px; line-height: 1.6; }
.fe-excerpt mark { border-radius: 3px; padding-inline: 2px; background: #dcc8fa; color: #2d1649; }
.fe-card .fe-explanation, .fe-empty p, .fe-checklist li { margin-top: 7px; color: var(--r-secondary, #bba8cd); font-size: 14px; line-height: 1.6; }
.fe-card .fe-replacement { margin-top: 8px; font-size: 16px; line-height: 1.5; font-weight: 600; }
.fe-card-actions { margin-top: 12px; }
.fe-checklist { margin-top: 16px; }
.fe-checklist ul { padding: 0; margin: 6px 0 0; list-style: none; }
.fe-checklist li { display: grid; grid-template-columns: minmax(88px, .34fr) minmax(0, 1fr); align-items: baseline; gap: 8px; padding-top: 5px; }
.fe-checklist li strong { color: var(--r-text, #f3ebfc); }
.fe-checklist li button { justify-self: start; text-align: left; overflow-wrap: anywhere; min-height: 36px; border-color: transparent; padding: 5px 8px; }
.fe-checklist .fe-missing strong { color: var(--r-accent, #be9cea); }
.fox-editor .fe-footer { margin: 0; border-top: 1px solid var(--r-border, #43334d); }
.fox-editor .fe-primary { background: #b89be8; color: #1c1425; border-color: transparent; font-weight: 650; }
html[data-theme="light"] .fox-editor .fe-primary { background: #744d9d; color: #fff; }
@media (max-width: 720px) {
  .fox-editor { width: 100%; height: 100dvh; border: 0; border-radius: 0; }
  .fe-header, .fox-editor .fe-footer { padding: 10px 12px; }
  .fe-brand img { width: 38px; height: 38px; }
  .fe-header-actions { gap: 5px; }
  .fox-editor .fe-ideas { padding-inline: 7px; }
  .fe-workspace { display: block; overflow: auto; overscroll-behavior: contain; }
  .fe-draft, .fe-review { padding: 14px 12px; }
  .fox-editor #fe-text, .fe-original { flex: auto; height: 32dvh; min-height: 180px; }
  .fe-checklist li button { min-height: 44px; }
  .fe-review { overflow: visible; border-left: 0; border-top: 1px solid var(--r-border, #43334d); }
  .fox-editor .fe-footer { align-items: stretch; flex-direction: column; gap: 6px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .fe-footer-actions button { flex: 1; }
}

.fe-diff-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; font-size: 13px; }
.fe-diff-legend span { border-radius: 5px; padding: 2px 6px; }
.fe-diff-text { white-space: break-spaces; }
.fe-diff-remove, .fe-diff-add { border-radius: 3px; box-decoration-break: clone; }
.fe-diff-remove { color: #ffd1d6; background: #663340; }
.fe-diff-add { color: #d3ffd9; background: #284c3b; text-decoration: underline; text-underline-offset: .15em; }
html[data-theme="light"] .fe-diff-remove { color: #761f36; background: #ffe0e8; }
html[data-theme="light"] .fe-diff-add { color: #164c33; background: #d8f6df; }
@media (max-width: 720px) {
  .fe-draft-head label, .fe-review-head h3 { font-size: 18px; }
  .fe-footer-actions button { min-height: 44px; padding-inline: 8px; }
  .fe-footer-actions .fe-primary { flex-basis: 100%; }
  .fe-header-actions .fe-close { min-height: 44px; min-width: 44px; }
}
