/* Tokion Editor — встроенный фоторедактор. Классы с префиксом ed-. */
.ed-page {
  position: fixed;
  /* Под шапкой и строкой подразделов «Изображений» (она общая для всех
     подразделов, редактор её не дублирует). */
  top: calc(var(--topbar-h, 4.25rem) + var(--subbar-h, 3rem));
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4000; /* .app-topbar поднят выше (5000), чтобы навигация была видна */
  display: flex;
  flex-direction: column;
  background: var(--bg1);
  color: var(--ink);
  font-family: inherit;
}
.ed-page * { box-sizing: border-box; }
.ed-page .hidden { display: none !important; }
/* :where() → нулевая специфичность, поэтому font-size из классов ниже не перебивается. */
.ed-page :where(button, input, select, textarea) { font: inherit; }
.ed-page :where(button, input, select, textarea) { margin: 0; }

/* «Папки» относятся к «Мои фото» — в строке подразделов над редактором не нужны. */
body.editor-open #btn-folders-open { display: none; }

/* ── Кнопки ─────────────────────────────────────────────────────── */
.ed-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 0.65rem;
  padding: 0.46rem 0.72rem;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.14s, border-color 0.14s, filter 0.14s;
}
.ed-btn:hover { background: var(--surface2); border-color: color-mix(in srgb, var(--ink) 25%, transparent); }
.ed-btn:active { transform: translateY(1px); }
.ed-btn:disabled { opacity: 0.45; cursor: default; }
.ed-btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
.ed-btn-primary:hover { filter: brightness(1.06); }
.ed-btn-ghost { background: transparent; }
.ed-btn-ghost:hover { background: var(--surface2); }
.ed-btn-icon { padding: 0.46rem 0.6rem; font-size: 1rem; }
.ed-btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }

/* ── Основная область ───────────────────────────────────────────── */
.ed-main { flex: 1; display: flex; min-height: 0; position: relative; }

/* ── Строка меню (Photopea-стиль) ───────────────────────────────── */
.ed-menubar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
  padding: 0.3rem 0.6rem;
  background: var(--bg0);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.ed-menus { display: flex; align-items: stretch; gap: 0.05rem; }
.ed-menu-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1;
  padding: 0.35rem 0.55rem;
  border-radius: 0.4rem;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
}
.ed-menu-btn:hover, .ed-menu-btn.open { background: var(--surface2); color: var(--ink); }
.ed-menu-drop {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  min-width: 236px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  box-shadow: 0 12px 32px rgba(0,0,0,0.18);
  padding: 0.25rem;
  z-index: 60;
}
.ed-menu-drop.align-right { left: auto; right: 0; }
.ed-menu-item {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 0.42rem 0.6rem;
  border-radius: 0.4rem;
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1.2;
  white-space: nowrap;
}
.ed-menu-item:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--ink); }
.ed-menu-item.disabled { opacity: 0.4; cursor: default; }
.ed-menu-item.disabled:hover { background: transparent; color: var(--ink); }
.ed-menu-sc { font-size: 0.66rem; color: var(--muted); flex: 0 0 auto; }
.ed-menu-sep { height: 1px; background: var(--line); margin: 0.25rem 0.4rem; }
.ed-menubar-spacer { flex: 1; }
/* Действия редактора справа в строке меню: вторичные — иконки с подсказками,
   «Скачать» и «Сохранить» — с подписями. */
.ed-actions { display: flex; align-items: center; gap: 0.3rem; flex: 0 0 auto; }
.ed-actions .ed-btn { padding: 0.4rem 0.62rem; }
.ed-actions .ed-btn-icon { width: 2.1rem; height: 2.1rem; padding: 0; }
.ed-actions-sep { width: 1px; height: 1.4rem; background: var(--line); margin: 0 0.2rem; }
@media (max-width: 1180px) { .ed-doctab { display: none; } }
.ed-doctab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 38vw;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom-color: transparent;
  border-radius: 0.5rem 0.5rem 0 0;
  padding: 0.22rem 0.7rem;
  font-size: 0.74rem;
  color: var(--muted);
}
.ed-doctab-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ed-doctab-zoom { color: var(--muted); font-size: 0.68rem; flex: 0 0 auto; }

/* ── Левый тулбар: только иконки (~44px), подсказки в title ─────── */
.ed-rail {
  width: 44px;
  flex: 0 0 44px;
  border-right: 1px solid var(--line);
  background: var(--card);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.45rem 0.25rem 0.9rem;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.ed-rail::-webkit-scrollbar { display: none; }
.ed-rail-btn {
  width: 34px;
  flex: 0 0 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 0.6rem;
  padding: 0.36rem 0 0.32rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ed-rail-btn .ed-rail-ico { font-size: 1.05rem; line-height: 1; }
.ed-rail-label { display: none; }
.ed-rail-btn:hover { background: var(--surface2); color: var(--ink); }
.ed-rail-btn.active { background: var(--accent-soft); color: var(--accent); }
.ed-rail-btn.active .ed-rail-label { color: var(--accent); font-weight: 600; }
.ed-rail-sep { width: 26px; align-self: center; height: 1px; background: var(--line); margin: 0.3rem 0; flex: 0 0 1px; }

/* ── Правый док: табы «Слои / Свойства» + панель + действия слоя ── */
.ed-dock {
  width: 280px;
  flex: 0 0 280px;
  border-left: 1px solid var(--line);
  background: var(--card);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.ed-dock-tabs {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.3rem 0.4rem;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.ed-dock-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 0.5rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.ed-dock-tab:hover { color: var(--ink); background: var(--surface2); }
.ed-dock-tab.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.ed-dock-spacer { flex: 1; }
.ed-dock-hide {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 24px;
  height: 24px;
  border-radius: 0.4rem;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}
.ed-dock-hide:hover { background: var(--surface2); color: var(--ink); }
.ed-dock-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; }
.ed-dock-actions {
  display: flex;
  gap: 0.2rem;
  padding: 0.3rem 0.4rem;
  border-top: 1px solid var(--line);
  flex: 0 0 auto;
}
.ed-dock-act {
  flex: 1 1 auto;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}
.ed-dock-act:hover { background: var(--surface2); color: var(--ink); }

.ed-panel {
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  overflow-y: auto;
  padding: 0.85rem;
}
.ed-panel.hidden { display: none; }
.ed-panel h4 {
  margin: 0 0 0.6rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}
.ed-group { margin-bottom: 1rem; }
.ed-group-title { font-size: 0.78rem; color: var(--muted); margin: 0 0 0.45rem; }
.ed-row { display: flex; gap: 0.4rem; }
.ed-row > * { flex: 1; }
.ed-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.ed-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.ed-grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; }
.ed-grid6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.3rem; }

.ed-field { margin-bottom: 0.7rem; }
.ed-field label { display: block; font-size: 0.76rem; color: var(--muted); margin-bottom: 0.25rem; }
.ed-input,
.ed-select,
.ed-textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 0.55rem;
  padding: 0.5rem 0.6rem;
  font-size: 0.86rem;
  outline: none;
}
.ed-input:focus, .ed-select:focus, .ed-textarea:focus { border-color: var(--accent); }
.ed-textarea { resize: vertical; min-height: 3.2rem; }
.ed-range { width: 100%; accent-color: var(--accent); }
.ed-slider-head { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--muted); margin-bottom: 0.15rem; }
.ed-slider-head b { color: var(--ink); font-weight: 500; }
.ed-slider { margin-bottom: 0.55rem; }

.ed-chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 0.6rem;
  padding: 0.46rem 0.55rem;
  cursor: pointer;
  font-size: 0.79rem;
  font-weight: 500;
  line-height: 1.15;
  text-align: center;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}
.ed-chip:hover { border-color: var(--accent); background: var(--surface2); color: var(--ink); }
.ed-chip.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.ed-grid3 .ed-chip { font-size: 0.74rem; padding: 0.42rem 0.3rem; }
.ed-grid6 .ed-chip { white-space: normal; }
.ed-hint { font-size: 0.72rem; color: var(--muted); margin: 0.3rem 0 0; line-height: 1.35; }
.ed-swatches { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ed-swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--ink) 25%, transparent); cursor: pointer; padding: 0; }
.ed-swatch.active { border-color: var(--accent); }

/* ── Слои ───────────────────────────────────────────────────────── */
.ed-layers { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 0.7rem; }
.ed-layer {
  display: flex; align-items: center; gap: 0.4rem;
  border: 1px solid var(--line); border-radius: 0.55rem;
  background: var(--card); padding: 0.3rem 0.4rem;
  cursor: pointer; transition: border-color 0.14s, background 0.14s;
}
.ed-layer:hover { border-color: color-mix(in srgb, var(--ink) 30%, transparent); }
.ed-layer.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.ed-layer.hidden-layer { opacity: 0.55; }
.ed-layer-ico { flex: 0 0 auto; font-size: 0.85rem; line-height: 1; }
.ed-layer-label {
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 0.78rem; color: var(--ink);
}
.ed-layer.active .ed-layer-label { color: var(--ink); font-weight: 600; }
.ed-layer-btn {
  flex: 0 0 auto; width: 24px; height: 24px; padding: 0;
  border: 0; background: transparent; border-radius: 0.4rem;
  color: var(--ink); font-size: 0.72rem; line-height: 1; cursor: pointer;
}
.ed-layer-btn:hover { background: var(--surface2); }
.ed-layer-btn.off, .ed-layer-btn.on { opacity: 0.95; }
.ed-layer-static { cursor: default; opacity: 0.5; }
/* Inline-переименование слоя: инпут вместо подписи, без window.prompt. */
.ed-layer-rename {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--accent);
  background: var(--card);
  color: var(--ink);
  border-radius: 0.4rem;
  padding: 0.08rem 0.3rem;
  font-size: 0.76rem;
  line-height: 1.3;
  outline: none;
}
/* Ряды слоёв стали плотнее: 5 кнопок (глаз/замок/карандаш/копия/корзина). */
.ed-layer .ed-layer-btn { width: 22px; }

/* ── Кривые ─────────────────────────────────────────────────────── */
.ed-curve {
  width: 100%; max-width: 260px; display: block; margin: 0.2rem auto 0.55rem;
  border: 1px solid var(--line); border-radius: 0.55rem; touch-action: none; cursor: crosshair;
  background: #141316;
}

/* ── Палитра команд (Ctrl+K) ────────────────────────────────────── */
.ed-palette {
  position: fixed; inset: 0; z-index: 4300;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 9vh 1rem 1rem;
}
.ed-palette-card {
  width: min(480px, 100%);
  background: var(--card); border: 1px solid var(--line); border-radius: 0.9rem;
  box-shadow: 0 20px 56px rgba(0,0,0,0.25); overflow: hidden;
  display: flex; flex-direction: column;
}
.ed-palette-input {
  width: 100%; border: 0; outline: none; background: transparent; color: var(--ink);
  padding: 0.8rem 0.95rem; font-size: 0.95rem; border-bottom: 1px solid var(--line);
}
.ed-palette-list { max-height: 46vh; overflow-y: auto; padding: 0.3rem; }
.ed-palette-item {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  border: 0; background: transparent; color: var(--ink); text-align: left;
  padding: 0.5rem 0.6rem; border-radius: 0.5rem; cursor: pointer; font-size: 0.85rem;
}
.ed-palette-item:hover { background: var(--surface2); }
.ed-palette-item.active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--ink); }
.ed-palette-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-palette-sc {
  flex: 0 0 auto; font-size: 0.68rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: 0.35rem; padding: 0.12rem 0.35rem;
}
.ed-palette-empty { padding: 0.8rem; color: var(--muted); font-size: 0.82rem; text-align: center; }

/* ── Справка по горячим клавишам ────────────────────────────────── */
.ed-help-list { display: flex; flex-direction: column; gap: 0.3rem; max-height: 52vh; overflow-y: auto; }
.ed-help-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.8rem;
  border-bottom: 1px dashed var(--line); padding: 0.28rem 0;
}
.ed-help-row b {
  flex: 0 0 auto; font-size: 0.72rem; font-weight: 600; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 0.35rem; padding: 0.14rem 0.4rem;
  white-space: nowrap;
}
.ed-help-row span { font-size: 0.8rem; color: var(--muted); text-align: right; }

/* ── Сцена ──────────────────────────────────────────────────────── */
.ed-stage {
  flex: 1;
  position: relative;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg1);
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 9%, transparent) 1px, transparent 1px);
  background-size: 18px 18px;
}
.ed-canvas-wrap { position: relative; }
.ed-canvas-wrap canvas { display: block; box-shadow: 0 8px 30px rgba(0,0,0,0.25); }
.ed-mask {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 25;
  cursor: crosshair;
  touch-action: none;
}
.ed-mask.hidden { display: none !important; }
.ed-drop {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  color: var(--muted);
  text-align: center;
  padding: 1.5rem;
  cursor: pointer;
}
.ed-drop.dragover { background: color-mix(in srgb, var(--accent) 8%, transparent); color: var(--ink); }
.ed-drop-ico { font-size: 2.4rem; }
.ed-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: color-mix(in srgb, var(--bg1) 75%, transparent);
  color: var(--ink);
  z-index: 5;
}
.ed-spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  animation: ed-spin 0.8s linear infinite;
}
@keyframes ed-spin { to { transform: rotate(360deg); } }

/* ── Нижняя AI-панель и зум ─────────────────────────────────────── */
.ed-bottom {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 24px));
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.ed-ai {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  background: color-mix(in srgb, var(--card) 96%, transparent);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  padding: 0.5rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  backdrop-filter: blur(6px);
}
.ed-ai textarea {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  resize: none;
  min-height: 1.6rem;
  max-height: 6rem;
  font-size: 0.88rem;
  line-height: 1.35;
  outline: none;
  padding: 0.35rem 0.4rem;
}
.ed-ai-side { flex: 0 0 auto; display: flex; flex-direction: column; gap: 0.35rem; align-items: stretch; }
.ed-ai-side .ed-select { font-size: 0.76rem; padding: 0.35rem 0.45rem; min-width: 116px; }
.ed-ai .ed-btn-primary { padding: 0.55rem 0.95rem; }
.ed-ai-ops { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: center; }
.ed-ai-ops .ed-chip { background: color-mix(in srgb, var(--card) 94%, transparent); flex: 0 0 auto; }

.ed-actionbar {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  padding: 0.3rem;
  box-shadow: 0 6px 18px rgba(0,0,0,0.1);
}
.ed-actionbar-btn {
  width: 34px; height: 34px; border: 0; background: transparent;
  color: var(--ink); border-radius: 0.55rem; cursor: pointer; font-size: 1.05rem;
}
.ed-actionbar-btn:hover { background: var(--surface2); }

.ed-zoombar {
  /* Слева сверху: снизу по центру стоит AI-панель, на узкой сцене они пересекались. */
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.25rem;
}
.ed-zoombar button {
  border: 0; background: transparent; color: var(--ink); cursor: pointer;
  width: 30px; height: 30px; border-radius: 0.5rem; font-size: 1rem;
}
.ed-zoombar button:hover { background: var(--surface2); }
.ed-zoom-val { font-size: 0.76rem; color: var(--muted); min-width: 42px; text-align: center; }

.ed-toast {
  position: fixed;
  left: 50%;
  top: 72px;
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--card) 97%, transparent);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0.55rem 0.9rem;
  border-radius: 0.6rem;
  font-size: 0.85rem;
  z-index: 4100;
  max-width: 80vw;
  text-align: center;
}
.ed-toast.err { border-color: color-mix(in srgb, var(--danger) 50%, transparent); color: var(--danger); }

/* ── Модалка сохранения ─────────────────────────────────────────── */
.ed-modal {
  position: fixed;
  inset: 0;
  z-index: 4200;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.ed-modal-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.1rem;
}
.ed-modal-card h3 { margin: 0 0 0.7rem; font-size: 1.05rem; }
.ed-modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; }

/* ── Иконки из спрайта (/app/icons.svg) вместо эмодзи ──────────── */
.ed-page .ic { width: 1.05rem; height: 1.05rem; vertical-align: middle; }
.ed-btn .ic { margin-right: 0.05rem; }
.ed-chip:has(> .ic) { display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; }
.ed-chip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ed-rail-btn .ed-rail-ico .ic { width: 1.2rem; height: 1.2rem; }
.ed-actionbar-btn, .ed-dock-act, .ed-layer-btn, .ed-btn-icon { display: inline-flex; align-items: center; justify-content: center; }
.ed-actionbar-btn .ic, .ed-dock-act .ic { width: 1.1rem; height: 1.1rem; }
.ed-layer-btn .ic, .ed-layer-ico .ic { width: 0.95rem; height: 0.95rem; }
.ed-layer-ico { color: var(--muted); display: inline-flex; }
.ed-drop-ico { color: var(--muted); }
.ed-drop-ico .ic { width: 2.6rem; height: 2.6rem; stroke-width: 1.4; }

/* ── Мобильная адаптация: сцена сверху, док-шторка, тулбар снизу ── */
@media (max-width: 760px) {
  .ed-btn { padding: 0.42rem 0.56rem; font-size: 0.78rem; }
  .ed-btn .ed-label-wide { display: none; }
  .ed-btn-primary { padding: 0.42rem 0.7rem; }
  .ed-main { flex-direction: column; }
  body.app-body:not(.telegram-mini) .ed-page { bottom: var(--bottom-nav-h, 0px); }
  .ed-menubar { flex-wrap: wrap; min-height: 0; padding: 0.25rem 0.3rem; gap: 0.15rem; overflow: visible; }
  .ed-menubar-spacer { display: none; }
  .ed-actions { order: -1; width: 100%; justify-content: flex-end; padding-bottom: 0.25rem; border-bottom: 1px solid var(--line); }
  .ed-actions .ed-btn-primary, .ed-actions .ed-btn:not(.ed-btn-icon) { flex: 0 0 auto; }
  .ed-menu-btn { padding: 0.3rem 0.35rem; font-size: 0.68rem; }
  .ed-doctab { display: none; } /* масштаб показан в панели зума */
  .ed-rail {
    width: 100%;
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    border-right: 0;
    border-top: 1px solid var(--line);
    order: 3;
    padding: 0.3rem;
    gap: 0.1rem;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .ed-rail-btn { width: 44px; flex: 0 0 44px; padding: 0.34rem 0 0.3rem; }
  .ed-rail-ico { font-size: 1.05rem; }
  .ed-rail-sep { width: 1px; height: 26px; margin: 0 0.25rem; flex: 0 0 1px; }
  .ed-stage { order: 1; flex: 1; }
  .ed-dock {
    order: 2;
    width: 100%;
    flex: 0 0 auto;
    max-height: 40vh;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .ed-dock-body { max-height: calc(40vh - 66px); }
  .ed-panel { max-height: none; }
  .ed-bottom { bottom: 52px; }
  .ed-ai { flex-direction: column; align-items: stretch; }
  .ed-ai-side { flex-direction: row; align-items: center; }
  .ed-ai-side .ed-select { flex: 1; }
  .ed-actionbar { top: 8px; right: 8px; }
  .ed-actionbar-btn { width: 30px; height: 30px; }
  .ed-zoombar { top: 8px; left: 8px; }
  .ed-ai-ops { overflow-x: auto; flex-wrap: nowrap; justify-content: flex-start; }
  .ed-palette { padding-top: 6vh; }
  .ed-palette-list { max-height: 42vh; }
  .ed-layer-label { font-size: 0.74rem; }
  .ed-curve { max-width: 100%; }
  .ed-help-row b { font-size: 0.66rem; }
  .ed-help-row span { font-size: 0.74rem; }
}
