/* site-editor — inline contentEditable редактор для mini-app прототипов.
 * Активен только при ?edit в URL или в реальном Telegram WebApp (см. editor.js).
 * Весь UI — fixed/overlay, не влияет на поток страницы (важно для check-html:
 * при обычной file:// загрузке без ?edit редактор спит и DOM не трогает). */

.se-launcher {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 2147483000;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: #1F2937;
  color: #fff;
  font-size: 20px;
  line-height: 48px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  padding: 0;
}
.se-launcher:hover { background: #111827; }
.se-launcher.se-active { background: #2563EB; }

/* Подсветка редактируемых единиц в режиме правки */
.se-editing [data-se-eid] {
  outline: 1px dashed rgba(37, 99, 235, 0.45);
  outline-offset: 1px;
  border-radius: 2px;
}
.se-editing [data-se-eid]:focus {
  outline: 2px solid #2563EB;
  background: rgba(37, 99, 235, 0.06);
}
.se-editing [data-se-eid].se-changed {
  outline: 1px solid #F59E0B;
  background: rgba(245, 158, 11, 0.08);
}

/* Нижнее меню */
.se-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2147483100;
  background: #111827;
  color: #E5E7EB;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
  display: none;
  flex-direction: column;
  max-height: 52vh;
}
.se-bar.se-open { display: flex; }

.se-bar__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.se-bar__title { font-weight: 600; font-size: 14px; }
.se-bar__count {
  background: #2563EB;
  color: #fff;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 600;
}
.se-bar__spacer { flex: 1; }
.se-bar__close {
  background: none;
  border: none;
  color: #9CA3AF;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
}
.se-bar__close:hover { color: #fff; }

.se-bar__list {
  overflow-y: auto;
  padding: 6px 0;
  flex: 1;
}
.se-empty { padding: 16px 14px; color: #9CA3AF; }

.se-edit {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.se-edit__texts { flex: 1; min-width: 0; line-height: 1.45; }
.se-edit__old {
  color: #FCA5A5;
  text-decoration: line-through;
  word-break: break-word;
}
.se-edit__new { color: #86EFAC; word-break: break-word; }
.se-edit__arrow { color: #6B7280; padding: 0 2px; }
.se-edit__revert {
  background: none;
  border: none;
  color: #9CA3AF;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px 4px;
  flex-shrink: 0;
}
.se-edit__revert:hover { color: #fff; }

.se-bar__foot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.se-check {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
}
.se-check input { width: 16px; height: 16px; cursor: pointer; }
.se-apply {
  margin-left: auto;
  background: #2563EB;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.se-apply:hover { background: #1D4ED8; }
.se-apply:disabled { background: #374151; color: #6B7280; cursor: default; }

/* Модалка с JSON для копирования (fallback к sendData) */
.se-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483200;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.se-modal.se-open { display: flex; }
.se-modal__card {
  background: #fff;
  color: #111827;
  border-radius: 12px;
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.se-modal__title { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.se-modal__hint { color: #4B5563; font-size: 13px; line-height: 1.5; margin-bottom: 12px; }
.se-modal__ta {
  width: 100%;
  flex: 1;
  min-height: 160px;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  resize: vertical;
}
.se-modal__row { display: flex; gap: 10px; margin-top: 12px; }
.se-modal__btn {
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.se-modal__btn--primary { background: #2563EB; color: #fff; }
.se-modal__btn--ghost { background: #E5E7EB; color: #111827; }
