/* GhostSocial — редактор медиа-баннера (mb6).
 * Снизу вверх: размытый затемнённый фон, настоящее медиа целиком (затемнено вне
 * капсулы), капсула-окно с чётким кадром. Ползунок масштаба слева.
 */

body.ghostsocial-v2 .gs-mb6 {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: #05040a;
  opacity: 0;
  transition: opacity .18s ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
body.ghostsocial-v2 .gs-mb6.is-open { opacity: 1; }
body.ghostsocial-v2 .gs-mb6:focus { outline: none; }

/* ── сцена ─────────────────────────────────────────────────────────────── */
body.ghostsocial-v2 .gs-mb6-stage {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  touch-action: none;
}

/* фон: то же медиа, размытое и затемнённое */
body.ghostsocial-v2 .gs-mb6-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  display: block;
  pointer-events: none;
  filter: blur(26px) brightness(.45) saturate(1.1);
  transform: scale(1.08);
  transform-origin: center;
}

/* настоящее медиа целиком, без блюра */
body.ghostsocial-v2 .gs-mb6-media {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  display: block;
  pointer-events: none;
  will-change: transform;
}

/* ── капсула: окно с чётким кадром, всё вокруг затемнено ───────────────── */
body.ghostsocial-v2 .gs-mb6-pill {
  position: absolute;
  z-index: 3;
  border-radius: 999px;
  box-shadow:
    0 0 0 1.5px rgba(255, 255, 255, .9),
    0 0 0 100vmax rgba(4, 3, 10, .62);
  cursor: grab;
  touch-action: none;
  transition: box-shadow .16s ease;
}
body.ghostsocial-v2 .gs-mb6-pill.is-dragging { cursor: grabbing; }
body.ghostsocial-v2 .gs-mb6-pill:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--accent, #b39af4),
    0 0 0 100vmax rgba(4, 3, 10, .62);
}

/* ── ползунок масштаба слева ───────────────────────────────────────────── */
body.ghostsocial-v2 .gs-mb6-scale {
  position: absolute;
  left: max(14px, env(safe-area-inset-left));
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
}
body.ghostsocial-v2 .gs-mb6-track {
  position: relative;
  width: 24px;
  height: min(46vh, 300px);
  display: flex;
  justify-content: center;
  cursor: ns-resize;
  touch-action: none;
  outline: none;
}
body.ghostsocial-v2 .gs-mb6-track::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .28);
}
body.ghostsocial-v2 .gs-mb6-thumb {
  position: absolute;
  left: 50%;
  width: 17px;
  height: 17px;
  margin-left: -8.5px;
  margin-top: -8.5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .55);
  transition: transform .12s ease;
}
body.ghostsocial-v2 .gs-mb6-track:focus-visible .gs-mb6-thumb,
body.ghostsocial-v2 .gs-mb6-track:hover .gs-mb6-thumb { transform: scale(1.12); }

/* ── кнопки ────────────────────────────────────────────────────────────── */
body.ghostsocial-v2 .gs-mb6-icon {
  position: absolute;
  z-index: 6;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  transition: background .15s ease, transform .15s ease;
}
body.ghostsocial-v2 .gs-mb6-icon:hover { background: rgba(255, 255, 255, .22); }
body.ghostsocial-v2 .gs-mb6-icon:active { transform: scale(.94); }
body.ghostsocial-v2 .gs-mb6-close {
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
}
body.ghostsocial-v2 .gs-mb6-play {
  bottom: max(18px, env(safe-area-inset-bottom));
  left: max(14px, env(safe-area-inset-left));
}

body.ghostsocial-v2 .gs-mb6-save {
  position: absolute;
  z-index: 6;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px 11px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--accent, #b39af4);
  color: #14101f;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  transition: transform .15s ease, opacity .15s ease;
}
body.ghostsocial-v2 .gs-mb6-save:hover { transform: translateY(-1px); }
body.ghostsocial-v2 .gs-mb6-save:active { transform: scale(.97); }
body.ghostsocial-v2 .gs-mb6-save.is-busy { opacity: .6; cursor: default; transform: none; }
body.ghostsocial-v2 .gs-mb6-save svg { width: 16px; height: 16px; }

/* ── подсказка и ошибка ────────────────────────────────────────────────── */
body.ghostsocial-v2 .gs-mb6-hint {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  margin: 0;
  max-width: 70vw;
  color: rgba(255, 255, 255, .55);
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
  transition: opacity .4s ease;
}
body.ghostsocial-v2 .gs-mb6-error {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: max(62px, calc(env(safe-area-inset-bottom) + 44px));
  transform: translateX(-50%);
  margin: 0;
  max-width: min(78vw, 460px);
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(255, 90, 106, .18);
  color: #ff9aa4;
  font-size: 12.5px;
  text-align: center;
  pointer-events: none;
}
body.ghostsocial-v2 .gs-mb6-error:empty { display: none; }

@media (max-width: 620px) {
  body.ghostsocial-v2 .gs-mb6-track { height: min(40vh, 240px); }
  body.ghostsocial-v2 .gs-mb6-save { padding: 10px 15px 10px 12px; font-size: 13px; }
  body.ghostsocial-v2 .gs-mb6-hint { display: none; }
  body.ghostsocial-v2 .gs-mb6-bg { filter: blur(20px) brightness(.45) saturate(1.1); }
}

@media (prefers-reduced-motion: reduce) {
  body.ghostsocial-v2 .gs-mb6,
  body.ghostsocial-v2 .gs-mb6-pill,
  body.ghostsocial-v2 .gs-mb6-thumb,
  body.ghostsocial-v2 .gs-mb6-icon,
  body.ghostsocial-v2 .gs-mb6-save { transition: none; }
}
