:root {
  --fx-editor-bg: #071225;
  --fx-editor-panel: #0b1b3a;
  --fx-editor-panel-2: #102b5a;
  --fx-editor-line: rgba(165, 196, 229, .18);
  --fx-editor-text: #f5f6f2;
  --fx-editor-muted: #8fa1ba;
  --fx-editor-accent: #ffdb45;
  --fx-editor-blue: #91c5e7;
}

.fx-editor-launch {
  position: fixed;
  z-index: 120;
  left: 22px;
  bottom: 22px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 15px 8px 9px;
  border: 1px solid rgba(255, 219, 69, .52);
  border-radius: 999px;
  background: rgba(7, 18, 37, .92);
  color: var(--fx-editor-text);
  box-shadow: 0 18px 55px rgba(0, 0, 0, .35);
  backdrop-filter: blur(18px);
  cursor: pointer;
  font: 650 12px/1 "Golos Text", Arial, sans-serif;
  letter-spacing: .01em;
  transition: transform .25s ease, border-color .25s ease, background .25s ease;
}

body.page-loading .fx-editor-launch,
body.page-loading .fx-text-editor,
body:not(.fx-editor-ready) .fx-editor-launch,
body:not(.fx-editor-ready) .fx-text-editor {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: none !important;
}

.fx-editor-launch:hover,
.fx-editor-launch:focus-visible {
  transform: translateY(-2px);
  border-color: var(--fx-editor-accent);
  background: rgba(11, 27, 58, .98);
}

.fx-editor-launch[hidden] { display: none; }

.fx-editor-launch__icon {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 50%;
  background: var(--fx-editor-accent);
  color: var(--fx-editor-bg);
  font: 800 12px/1 Georgia, serif;
}

.fx-text-editor {
  position: fixed;
  z-index: 150;
  inset: 0 0 0 auto;
  display: flex;
  width: min(420px, 100vw);
  flex-direction: column;
  border-left: 1px solid var(--fx-editor-line);
  background: rgba(7, 18, 37, .985);
  color: var(--fx-editor-text);
  box-shadow: -26px 0 90px rgba(0, 0, 0, .42);
  font-family: "Golos Text", Arial, sans-serif;
  transform: translateX(105%);
  visibility: hidden;
  transition: transform .42s cubic-bezier(.2,.75,.3,1), visibility .42s ease;
}

.fx-text-editor[hidden] { display: none; }
.fx-text-editor.is-open { transform: none; visibility: visible; }
.fx-text-editor[aria-hidden="true"] { transform: translateX(105%) !important; visibility: hidden !important; }

.fx-text-editor *,
.fx-text-editor *::before,
.fx-text-editor *::after { box-sizing: border-box; }

.fx-editor-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: start;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--fx-editor-line);
  background: linear-gradient(135deg, rgba(16,43,90,.75), rgba(7,18,37,.15));
}

.fx-editor-eyebrow {
  margin: 0 0 6px;
  color: var(--fx-editor-accent);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.fx-editor-head h2 { margin: 0; color: var(--fx-editor-text); font-size: 21px; font-weight: 620; letter-spacing: -.03em; }
.fx-editor-head p:last-child { margin: 7px 0 0; color: var(--fx-editor-muted); font-size: 11px; line-height: 1.4; }

.fx-editor-icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--fx-editor-line);
  border-radius: 5px;
  background: rgba(255,255,255,.025);
  color: var(--fx-editor-text);
  cursor: pointer;
  font: 300 23px/1 Arial, sans-serif;
}

.fx-editor-scroll {
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(145,197,231,.3) transparent;
}

.fx-editor-block-picker {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid var(--fx-editor-line);
  background: #08162e;
}
.fx-editor-block-picker span { color: var(--fx-editor-muted); font-size: 9px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.fx-editor-block-picker select { height: 34px; }

.fx-editor-empty { padding: 26px 20px; }
.fx-editor-empty__mark { display: grid; width: 48px; height: 48px; margin-bottom: 18px; place-items: center; border: 1px dashed var(--fx-editor-blue); border-radius: 50%; color: var(--fx-editor-blue); font-size: 20px; }
.fx-editor-empty h3 { margin: 0 0 9px; color: var(--fx-editor-text); font-size: 19px; font-weight: 570; letter-spacing: -.025em; }
.fx-editor-empty p { margin: 0; color: var(--fx-editor-muted); font-size: 13px; line-height: 1.55; }
.fx-editor-empty ol { display: grid; gap: 9px; margin: 22px 0 0; padding: 18px 18px 18px 34px; border: 1px solid var(--fx-editor-line); border-radius: 6px; background: rgba(255,255,255,.025); color: #b8c4d4; font-size: 12px; line-height: 1.45; }

.fx-editor-controls[hidden],
.fx-editor-empty[hidden] { display: none; }

.fx-editor-selection {
  position: sticky;
  z-index: 2;
  top: 0;
  padding: 12px 20px;
  border-bottom: 1px solid var(--fx-editor-line);
  background: rgba(11, 27, 58, .98);
  backdrop-filter: blur(12px);
}

.fx-editor-selection span { display: block; color: var(--fx-editor-muted); font-size: 9px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.fx-editor-selection strong { display: block; margin-top: 4px; overflow: hidden; color: var(--fx-editor-text); font: 520 12px/1.35 monospace; text-overflow: ellipsis; white-space: nowrap; }

.fx-editor-group { padding: 20px; border-bottom: 1px solid var(--fx-editor-line); }
.fx-editor-group > h3 { margin: 0 0 15px; color: var(--fx-editor-blue); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.fx-editor-help { margin: -4px 0 14px; color: var(--fx-editor-muted); font-size: 10px; line-height: 1.45; }

.fx-editor-field { display: grid; gap: 7px; margin-bottom: 14px; }
.fx-editor-field:last-child { margin-bottom: 0; }
.fx-editor-field > span,
.fx-editor-field > label { color: #aab8ca; font-size: 10px; font-weight: 650; line-height: 1.2; }

.fx-text-editor textarea,
.fx-text-editor input[type="text"],
.fx-text-editor input[type="number"],
.fx-text-editor select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--fx-editor-line);
  border-radius: 5px;
  outline: 0;
  background: rgba(255,255,255,.035);
  color: var(--fx-editor-text);
  font: 400 12px/1.35 "Golos Text", Arial, sans-serif;
}

.fx-text-editor textarea { min-height: 118px; padding: 12px; resize: vertical; line-height: 1.5; }
.fx-text-editor input[type="text"],
.fx-text-editor input[type="number"],
.fx-text-editor select { height: 39px; padding: 0 10px; }
.fx-text-editor textarea:focus,
.fx-text-editor input:focus,
.fx-text-editor select:focus { border-color: rgba(255,219,69,.8); box-shadow: 0 0 0 2px rgba(255,219,69,.08); }
.fx-text-editor select option { background: #0b1b3a; color: #f5f6f2; }

.fx-editor-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fx-editor-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.fx-editor-grid-2 .fx-editor-field,
.fx-editor-grid-3 .fx-editor-field { margin-bottom: 0; }

.fx-editor-range-row { display: grid; grid-template-columns: 1fr 76px; gap: 10px; align-items: center; }
.fx-text-editor input[type="range"] { width: 100%; accent-color: var(--fx-editor-accent); }

.fx-editor-color-row { display: grid; grid-template-columns: 42px 1fr; gap: 10px; }
.fx-text-editor input[type="color"] { width: 42px; height: 39px; padding: 3px; border: 1px solid var(--fx-editor-line); border-radius: 5px; background: transparent; cursor: pointer; }

.fx-editor-align { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.fx-editor-align button {
  height: 37px;
  border: 1px solid var(--fx-editor-line);
  border-radius: 4px;
  background: rgba(255,255,255,.025);
  color: #aebbc9;
  cursor: pointer;
  font: 600 11px/1 monospace;
}
.fx-editor-align button.is-active { border-color: var(--fx-editor-accent); background: var(--fx-editor-accent); color: var(--fx-editor-bg); }

.fx-editor-upload {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px dashed rgba(145,197,231,.35);
  border-radius: 5px;
  color: #b8c6d7;
  cursor: pointer;
  font-size: 11px;
}
.fx-editor-upload input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.fx-editor-upload b { color: var(--fx-editor-blue); font-weight: 650; }
.fx-editor-font-status { margin: 8px 0 0; color: var(--fx-editor-muted); font-size: 9px; line-height: 1.4; }

.fx-editor-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fx-editor-button {
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--fx-editor-line);
  border-radius: 5px;
  background: rgba(255,255,255,.035);
  color: var(--fx-editor-text);
  cursor: pointer;
  font: 650 11px/1.25 "Golos Text", Arial, sans-serif;
}
.fx-editor-button:hover { border-color: rgba(145,197,231,.55); background: rgba(145,197,231,.08); }
.fx-editor-button--accent { border-color: var(--fx-editor-accent); background: var(--fx-editor-accent); color: var(--fx-editor-bg); }
.fx-editor-button--accent:hover { background: #ffe471; }
.fx-editor-button--danger { color: #eaa5a5; }
.fx-editor-button--wide { grid-column: 1 / -1; }

.fx-editor-variant-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.fx-editor-variant-row .fx-editor-button { min-width: 96px; }
.fx-editor-variant-select { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; margin-top: 9px; }
.fx-editor-variant-select .fx-editor-button { width: 42px; min-width: 0; padding: 0; }

.fx-editor-status {
  min-height: 36px;
  margin: 0;
  padding: 11px 20px;
  border-top: 1px solid var(--fx-editor-line);
  background: #050d1d;
  color: var(--fx-editor-muted);
  font-size: 10px;
  line-height: 1.35;
}
.fx-editor-status.is-success { color: #8ed6b5; }
.fx-editor-status.is-warning { color: var(--fx-editor-accent); }

body.fx-editor-active [data-fx-text-id] { cursor: text; }
body.fx-editor-active [data-fx-text-id]:hover {
  outline: 1px dashed rgba(255, 219, 69, .8);
  outline-offset: 5px;
}
body.fx-editor-active [data-fx-text-id].fx-editor-selected {
  outline: 2px solid var(--fx-editor-accent);
  outline-offset: 6px;
  box-shadow: 0 0 0 8px rgba(255, 219, 69, .06);
}
body.fx-editor-active [data-fx-surface-id].fx-editor-surface-selected {
  outline: 2px dashed rgba(145, 197, 231, .92);
  outline-offset: 10px;
}
body.fx-editor-active [data-fx-text-id].fx-editor-selected.fx-editor-surface-selected {
  outline: 2px solid var(--fx-editor-accent);
  outline-offset: 6px;
}

@media (max-width: 767px) {
  .fx-editor-launch { left: 14px; bottom: 14px; }
  .fx-editor-launch__label { display: none; }
  .fx-editor-launch { padding-right: 9px; }
  .fx-text-editor { width: 100vw; }
  .fx-editor-grid-3 { grid-template-columns: 1fr 1fr; }
  .fx-editor-block-picker { grid-template-columns: 1fr; gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  .fx-text-editor,
  .fx-editor-launch { transition-duration: .001ms !important; }
}
