/* Обучение GhostSound: интро с авророй, подсветка шагов, карточка подсказки.
   Визуал повторяет обучение GhostSocial: восемь плывущих пятен авроры,
   затемнение четырьмя кусками вокруг подсветки и всплывающая карточка. */

/* ── Слой обучения ─────────────────────────────── */

.gs-tour-layer {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  color: #f7f4fb;
  pointer-events: none;
}

.gs-tour-layer.is-on { display: block; }

/* элементы шага убираются с анимацией, аврора остаётся на месте */
.gs-tour-layer.is-leaving > :not(.gs-tour-aurora) {
  pointer-events: none !important;
}

.gs-tour-layer.is-leaving > .gs-tour-card { animation: gsTourHintOut .24s cubic-bezier(.4, 0, .7, .4) both; }
.gs-tour-layer.is-leaving > .gs-tour-focus { animation: gsTourFocusOut .22s ease both; }
.gs-tour-layer.is-leaving > .gs-tour-shade { animation: gsTourShadeOut .22s ease both; }
.gs-tour-layer.is-leaving > .gs-tour-lock { animation: gsTourLockOut .18s linear both; }

/* ── Аврора ────────────────────────────────────── */

.gs-tour-aurora {
  position: fixed;
  inset: auto 0 0;
  z-index: 1;
  height: clamp(230px, 42vh, 390px);
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(0deg, #000 0%, rgba(0, 0, 0, .96) 18%,
    rgba(0, 0, 0, .84) 40%, rgba(0, 0, 0, .60) 65%, rgba(0, 0, 0, .30) 80%,
    rgba(0, 0, 0, .10) 92%, transparent 100%);
  mask-image: linear-gradient(0deg, #000 0%, rgba(0, 0, 0, .96) 18%,
    rgba(0, 0, 0, .84) 40%, rgba(0, 0, 0, .60) 65%, rgba(0, 0, 0, .30) 80%,
    rgba(0, 0, 0, .10) 92%, transparent 100%);
  animation: gsTourAuroraRise .9s cubic-bezier(.2, .75, .2, 1) .05s both;
}

.gs-tour-aurora.is-top {
  inset: 0 0 auto;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .96) 18%,
    rgba(0, 0, 0, .84) 40%, rgba(0, 0, 0, .60) 65%, rgba(0, 0, 0, .30) 80%,
    rgba(0, 0, 0, .10) 92%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .96) 18%,
    rgba(0, 0, 0, .84) 40%, rgba(0, 0, 0, .60) 65%, rgba(0, 0, 0, .30) 80%,
    rgba(0, 0, 0, .10) 92%, transparent 100%);
  animation: gsIntroAuroraReveal .9s cubic-bezier(.22, 1, .36, 1) .08s both;
}

/* нижняя аврора без отражения: маска и так гаснет к верху */
.gs-tour-aurora.is-bottom {
  inset: auto 0 0;
  -webkit-mask-image: linear-gradient(0deg, #000 0%, rgba(0, 0, 0, .92) 22%,
    rgba(0, 0, 0, .62) 48%, rgba(0, 0, 0, .26) 74%, transparent 100%);
  mask-image: linear-gradient(0deg, #000 0%, rgba(0, 0, 0, .92) 22%,
    rgba(0, 0, 0, .62) 48%, rgba(0, 0, 0, .26) 74%, transparent 100%);
  animation: gsIntroAuroraReveal .9s cubic-bezier(.22, 1, .36, 1) .2s both;
}

/* пятна широкие и перекрываются: свечение плывёт мягко, без качания вбок */
.gs-aurora-glow {
  position: absolute;
  top: -55%;
  left: var(--aurora-left, 0%);
  width: var(--aurora-width, 46%);
  height: 200%;
  background: radial-gradient(ellipse at 50% 50%, var(--aurora-color, transparent) 0%,
    transparent 68%);
  transform-origin: 50% 50%;
  will-change: transform, opacity;
  animation: gsAuroraFlow var(--aurora-duration, 12s) ease-in-out var(--aurora-delay, 0s) infinite;
}

.gs-aurora-glow:nth-child(1) { --aurora-left: -18%; --aurora-width: 52%; --aurora-color: rgba(179, 154, 244, .30); --aurora-duration: 13s; --aurora-delay: -1.4s; }
.gs-aurora-glow:nth-child(2) { --aurora-left: -2%; --aurora-width: 46%; --aurora-color: rgba(124, 111, 235, .26); --aurora-duration: 15.5s; --aurora-delay: -4.6s; }
.gs-aurora-glow:nth-child(3) { --aurora-left: 12%; --aurora-width: 54%; --aurora-color: rgba(186, 120, 226, .24); --aurora-duration: 12.5s; --aurora-delay: -2.8s; }
.gs-aurora-glow:nth-child(4) { --aurora-left: 27%; --aurora-width: 48%; --aurora-color: rgba(110, 136, 232, .22); --aurora-duration: 16s; --aurora-delay: -6.1s; }
.gs-aurora-glow:nth-child(5) { --aurora-left: 41%; --aurora-width: 52%; --aurora-color: rgba(150, 104, 226, .28); --aurora-duration: 14s; --aurora-delay: -3.7s; }
.gs-aurora-glow:nth-child(6) { --aurora-left: 55%; --aurora-width: 56%; --aurora-color: rgba(96, 178, 178, .16); --aurora-duration: 17s; --aurora-delay: -5.2s; }
.gs-aurora-glow:nth-child(7) { --aurora-left: 68%; --aurora-width: 50%; --aurora-color: rgba(154, 114, 228, .26); --aurora-duration: 13.5s; --aurora-delay: -1.8s; }
.gs-aurora-glow:nth-child(8) { --aurora-left: 82%; --aurora-width: 48%; --aurora-color: rgba(108, 136, 214, .22); --aurora-duration: 15s; --aurora-delay: -6.5s; }
.gs-aurora-glow:nth-child(9) { --aurora-left: 94%; --aurora-width: 54%; --aurora-color: rgba(179, 154, 244, .24); --aurora-duration: 16.5s; --aurora-delay: -8.2s; }
.gs-aurora-glow:nth-child(10) { --aurora-left: 34%; --aurora-width: 44%; --aurora-color: rgba(143, 120, 236, .20); --aurora-duration: 18s; --aurora-delay: -10.4s; }

/* ── Затемнение вокруг подсветки ───────────────── */

.gs-tour-shade {
  position: fixed;
  z-index: 0;
  background: rgba(5, 4, 9, .76);
  pointer-events: auto;
  animation: gsTourShadeIn .24s ease both;
}

.gs-tour-focus {
  position: fixed;
  z-index: 2;
  /* контур через outline: глобальное правило гасит border-color */
  outline: 2px solid var(--primary, #b39af4);
  outline-offset: 0;
  box-shadow: 0 0 0 4px rgba(179, 154, 244, .14);
  pointer-events: none;
  animation: gsTourFocusReveal .34s cubic-bezier(.2, .75, .2, 1) both;
  transition: border-radius .16s ease;
}

.gs-tour-lock {
  position: fixed;
  z-index: 3;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
  cursor: default;
}

/* шаг с ожиданием действия: подсвеченный элемент остаётся нажимаемым */
.gs-tour-lock.is-pass-through { pointer-events: none; }

/* ── Карточка подсказки ───────────────────────── */

.gs-tour-card {
  position: fixed;
  z-index: 4;
  isolation: isolate;
  overflow: hidden;
  width: min(320px, calc(100vw - 28px));
  box-sizing: border-box;
  padding: 14px 15px 12px;
  border-radius: 18px;
  background: rgba(27, 25, 32, .94);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .5);
  pointer-events: auto;
  animation: gsTourHintIn .42s cubic-bezier(.16, 1, .3, 1) both;
}

.gs-tour-hint-aurora {
  position: absolute;
  inset: auto 0 0;
  width: 100%;
  height: 82%;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  border-radius: inherit;
  opacity: .9;
  background: linear-gradient(0deg, rgba(122, 88, 180, .13), transparent 78%);
  -webkit-mask-image: linear-gradient(0deg, #000 0%, rgba(0, 0, 0, .9) 34%,
    rgba(0, 0, 0, .42) 72%, transparent 100%);
  mask-image: linear-gradient(0deg, #000 0%, rgba(0, 0, 0, .9) 34%,
    rgba(0, 0, 0, .42) 72%, transparent 100%);
  animation: gsTourHintAuroraUp .95s cubic-bezier(.22, 1, .36, 1) .06s both;
}

.gs-tour-hint-aurora .gs-aurora-glow { top: 10%; height: 180%; }

.gs-tour-card-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.gs-tour-icon {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--primary, #b39af4);
  background: rgba(179, 154, 244, .12);
}

.gs-tour-icon .icon { width: 17px; height: 17px; }

.gs-tour-copy { min-width: 0; flex: 1; }

.gs-tour-title {
  display: block;
  color: #fff;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.2px;
}

.gs-tour-text {
  display: block;
  margin-top: 3px;
  color: rgba(240, 236, 247, .68);
  font-size: 11.5px;
  line-height: 1.35;
  font-weight: 500;
}

.gs-tour-count {
  align-self: flex-start;
  color: rgba(240, 236, 247, .48);
  font-size: 10px;
  line-height: 1;
  font-weight: 700;
  white-space: nowrap;
}

.gs-tour-card-bottom {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
  margin-top: 11px;
}

.gs-tour-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 6px;
}

.gs-tour-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .2);
  transition: width .18s ease, background .18s ease;
}

.gs-tour-dot.is-active { width: 13px; border-radius: 8px; background: var(--primary, #b39af4); }

.gs-tour-card-actions { display: flex; align-items: center; gap: 6px; }

.gs-tour-btn {
  min-height: 32px;
  padding: 0 11px;
  border: 0;
  border-radius: 10px;
  color: rgba(245, 240, 251, .66);
  background: transparent;
  font: inherit;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .12s ease;
}

.gs-tour-btn:focus-visible { outline: 2px solid var(--primary, #b39af4); outline-offset: 2px; }

.gs-tour-back {
  flex: 0 0 34px;
  width: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  background: rgba(255, 255, 255, .05);
}

.gs-tour-back .icon { width: 15px; height: 15px; }
.gs-tour-back:disabled { opacity: .3; cursor: default; }

.gs-tour-skip { margin-left: auto; padding: 0 6px; white-space: nowrap; }
.gs-tour-skip:hover, .gs-tour-back:hover { color: #fff; background: rgba(255, 255, 255, .08); }

.gs-tour-next {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 13px;
  color: #21182d;
  background: #c9a8ff;
  font-weight: 700;
}

.gs-tour-next:hover { background: #d5bbff; }
.gs-tour-next:active { transform: scale(.97); }
.gs-tour-next:disabled { opacity: .55; cursor: default; transform: none; }
.gs-tour-next .icon { width: 14px; height: 14px; }

/* на время знакомства прячем приложение: смена слайда не подсвечивает фон */
body.gs-tour-intro-open > :not(.gs-tour-layer) {
  visibility: hidden !important;
}

/* ── Интро ─────────────────────────────────────── */

.gs-tour-intro {
  position: fixed;
  z-index: 5;
  inset: 0;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: max(34px, env(safe-area-inset-top)) 23px 104px;
  color: #f6f4f8;
  background: #101012;
  pointer-events: auto;
  animation: gsIntroFade .24s ease both;
}

.gs-tour-intro-copy {
  position: relative;
  z-index: 1;
  max-width: 720px;
  padding-top: clamp(38px, 9vh, 76px);
}

.gs-tour-intro-title {
  margin: 0;
  color: #f6f4f8;
  font-size: clamp(40px, 10.5vw, 58px);
  font-weight: 760;
  letter-spacing: -.055em;
  line-height: 1.04;
  text-wrap: balance;
}

.gs-tour-intro-title .gs-tour-line {
  display: block;
  animation: gsIntroText .58s cubic-bezier(.2, .75, .2, 1) both;
}

.gs-tour-intro-title .gs-tour-line:nth-child(2) { animation-delay: .1s; }
.gs-tour-intro-title em { color: var(--primary, #c7a8ff); font-style: normal; }

.gs-tour-intro-description {
  max-width: 310px;
  margin: 14px 0 0;
  color: rgba(240, 236, 247, .68);
  font-size: 16px;
  line-height: 1.5;
  animation: gsIntroText .5s ease .18s both;
}

.gs-tour-intro-progress {
  position: fixed;
  z-index: 6;
  left: 23px;
  bottom: max(112px, calc(env(safe-area-inset-bottom) + 90px));
  display: flex;
  align-items: center;
  gap: 7px;
  animation: gsIntroControls .4s ease .12s both;
}

.gs-tour-intro-progress span {
  width: 7px;
  height: 7px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .24);
  transition: width .2s ease, background .2s ease;
}

.gs-tour-intro-progress span.is-active { width: 23px; background: var(--primary, #bb94ff); }

.gs-tour-intro-controls {
  position: fixed;
  z-index: 6;
  right: 18px;
  bottom: max(92px, calc(env(safe-area-inset-bottom) + 70px));
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  animation: gsIntroControls .4s ease .12s both;
}

.gs-tour-intro-back {
  min-width: 104px;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .06);
  font-size: 15px;
  color: rgba(240, 236, 247, .82);
}

.gs-tour-intro-next {
  min-width: 128px;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 17px;
  border-radius: 14px;
  color: #21172c;
  background: #bb94ff;
  font-size: 15px;
  font-weight: 700;
  animation: gsIntroControls .4s ease .18s both;
}

.gs-tour-intro-next:hover { background: #c7a8ff; }
.gs-tour-intro-next:active { transform: scale(.97); }
.gs-tour-intro-next .icon { width: 16px; height: 16px; }

/* ── Кадры анимаций ───────────────────────────── */

@keyframes gsAuroraFlow {
  0%, 100% { transform: translate3d(0, -2%, 0) scale(1, 1); opacity: .6; }
  50% { transform: translate3d(1.5%, 4%, 0) scale(1.06, .94); opacity: 1; }
}

@keyframes gsTourAuroraRise {
  from { opacity: 0; transform: translateY(24px); filter: blur(14px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes gsIntroAuroraReveal {
  from { opacity: 0; filter: blur(12px); }
  to { opacity: 1; filter: blur(0); }
}

@keyframes gsTourHintIn {
  from { opacity: 0; transform: translate3d(0, 18px, 0) scale(.985); filter: blur(6px); }
  65% { opacity: 1; filter: blur(0); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes gsTourHintOut {
  from { opacity: 1; transform: translate3d(0, 0, 0) scale(1); filter: blur(0); }
  to { opacity: 0; transform: translate3d(0, -12px, 0) scale(.99); filter: blur(4px); }
}

@keyframes gsTourHintAuroraUp {
  from { opacity: 0; transform: translate3d(0, 24px, 0); filter: blur(12px); }
  55% { opacity: .72; }
  to { opacity: .9; transform: translate3d(0, 0, 0); filter: blur(0); }
}

@keyframes gsTourFocusReveal {
  from { opacity: 0; transform: scale(.94); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes gsTourFocusOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(.97); }
}

@keyframes gsTourShadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes gsTourShadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes gsTourLockOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes gsIntroFade { from { opacity: 0; } to { opacity: 1; } }

@keyframes gsIntroText {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes gsIntroControls {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Узкие экраны и меньше движения ───────────── */

@media (max-width: 420px) {
  .gs-tour-card { padding: 12px 12px 10px; border-radius: 16px; }
  .gs-tour-title { font-size: 14px; }
  .gs-tour-text { font-size: 11px; }
}

@media (max-width: 380px) {
  .gs-tour-intro { padding-right: 18px; padding-left: 18px; }
  .gs-tour-intro-next { min-width: 118px; }
  .gs-tour-intro-back { min-width: 96px; }
}

@media (max-height: 700px) and (max-width: 760px) {
  .gs-tour-intro { padding-top: max(22px, env(safe-area-inset-top)); }
  .gs-tour-intro-copy { padding-top: clamp(34px, 8vh, 56px); }
}

@media (prefers-reduced-motion: reduce) {
  .gs-aurora-glow,
  .gs-tour-aurora,
  .gs-tour-hint-aurora,
  .gs-tour-card,
  .gs-tour-focus,
  .gs-tour-shade,
  .gs-tour-intro,
  .gs-tour-intro-title .gs-tour-line,
  .gs-tour-intro-description,
  .gs-tour-intro-controls,
  .gs-tour-intro-next,
  .gs-tour-intro-progress,
  .gs-tour-layer.is-leaving > .gs-tour-card,
  .gs-tour-layer.is-leaving > .gs-tour-focus,
  .gs-tour-layer.is-leaving > .gs-tour-shade,
  .gs-tour-layer.is-leaving > .gs-tour-lock {
    animation: none !important;
    filter: none !important;
  }

  .gs-tour-dot { transition: none; }
}
