/* ═══════════════════════════════════════════════════════════════════
   SPARK — spark-onboarding.css   OnboardingEngine v1
   Стили для приветственного гида. Подключается в <head> index.html.
   Все классы используют префикс .ob- во избежание коллизий.
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Overlay ─── */
.ob-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 6, 15, 0.97);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
  font-family: "DM Sans", sans-serif;
}

.ob-overlay.ob-visible {
  opacity: 1;
  pointer-events: all;
}

.ob-overlay.ob-exit {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.55s ease;
}

/* ─── Stars background ─── */
.ob-stars {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.ob-star-particle {
  position: absolute;
  border-radius: 50%;
  background: #ffffff;
}

/* ─── Orbital decorative blobs ─── */
.ob-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(80px);
  opacity: 0.06;
}

.ob-orb-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #7B5CFA 0%, transparent 70%);
  top: -100px;
  right: -80px;
  animation: obOrbFloat 8s ease-in-out infinite;
}

.ob-orb-2 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, #E8C55A 0%, transparent 70%);
  bottom: -60px;
  left: -60px;
  animation: obOrbFloat 11s ease-in-out 2s infinite reverse;
}

/* ─── Card ─── */
.ob-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  border: 1px solid rgba(123, 92, 250, 0.22);
  background: rgba(10, 11, 24, 0.96);
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(123, 92, 250, 0.06),
    0 0 60px rgba(123, 92, 250, 0.1),
    0 28px 80px rgba(0, 0, 0, 0.75);
}

/* Top accent line */
.ob-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #7B5CFA, #E85AA0, #E8C55A, #5AE8C5);
  opacity: 0.7;
  z-index: 1;
}

/* ─── Skip button ─── */
.ob-skip {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: rgba(110, 112, 153, 0.75);
  font: 0.79rem/1 "DM Sans", sans-serif;
  font-weight: 500;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
  z-index: 10;
  letter-spacing: 0.03em;
}

.ob-skip:hover {
  color: rgba(238, 240, 255, 0.8);
  background: rgba(255, 255, 255, 0.05);
}

/* ─── Progress dots ─── */
.ob-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px 24px 0;
  flex-shrink: 0;
}

.ob-dot {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  cursor: pointer;
  padding: 0;
  transition:
    width 0.38s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.3s ease,
    opacity 0.3s ease;
  flex-shrink: 0;
}

.ob-dot:hover {
  background: rgba(123, 92, 250, 0.5);
}

.ob-dot.ob-active {
  width: 22px;
  background: linear-gradient(90deg, #7B5CFA, #9B7CFF);
}

/* ─── Visual area ─── */
.ob-visual-wrap {
  flex-shrink: 0;
  padding: 14px 32px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ob-vis {
  width: 210px;
  height: 174px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ob-vis svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* ─── Slide container ─── */
.ob-slides {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.ob-slide {
  width: 100%;
  transition:
    transform 0.38s cubic-bezier(0.4, 0, 0.2, 1),
    opacity   0.38s ease;
}

.ob-slide.ob-entering-right {
  transform: translateX(52px);
  opacity: 0;
}

.ob-slide.ob-entering-left {
  transform: translateX(-52px);
  opacity: 0;
}

.ob-slide.ob-exiting {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  pointer-events: none;
}

/* ─── Text content ─── */
.ob-content {
  flex: 1 1 auto;
  padding: 14px 28px 6px;
  text-align: center;
  overflow: hidden;
}

.ob-kicker {
  font-size: 0.71rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(155, 95, 255, 0.75);
  font-weight: 700;
  font-family: "Syne", sans-serif;
  margin-bottom: 8px;
}

.ob-title {
  font-size: 1.57rem;
  font-weight: 800;
  font-family: "Syne", sans-serif;
  color: #EEF0FF;
  line-height: 1.2;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}

.ob-desc {
  font-size: 1rem;
  line-height: 1.65;
  color: rgba(110, 112, 153, 0.92);
  margin: 0;
  font-weight: 400;
}

/* ─── Navigation ─── */
.ob-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px 20px;
  flex-shrink: 0;
  gap: 12px;
}

.ob-btn-back {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: rgba(110, 112, 153, 0.8);
  font: 500 0.93rem/1 "DM Sans", sans-serif;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}

.ob-btn-back:hover {
  border-color: rgba(255, 255, 255, 0.18);
  color: rgba(238, 240, 255, 0.75);
  background: rgba(255, 255, 255, 0.03);
}

.ob-btn-back.hidden {
  visibility: hidden;
  pointer-events: none;
}

.ob-btn-next {
  background: linear-gradient(135deg, #7B5CFA 0%, #9B7CFF 100%);
  color: #fff;
  border: none;
  font: 700 0.93rem/1 "Syne", sans-serif;
  padding: 11px 24px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.ob-btn-next:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(123, 92, 250, 0.48);
}

.ob-btn-next:active {
  transform: translateY(0) scale(0.97);
}

/* ─── CTA (last slide) ─── */
.ob-cta-wrap {
  padding: 0 22px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.ob-btn-cta {
  background: linear-gradient(135deg, #E8C55A 0%, #C8930A 100%);
  color: #05060F;
  border: none;
  font: 800 1.07rem/1 "Syne", sans-serif;
  padding: 14px 32px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  letter-spacing: 0.02em;
  width: 100%;
}

.ob-btn-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(232, 197, 90, 0.48);
}

.ob-btn-cta:active {
  transform: translateY(0) scale(0.97);
}

.ob-signin-link {
  text-align: center;
  font-size: 0.86rem;
  color: rgba(110, 112, 153, 0.7);
  padding-bottom: 4px;
}

.ob-signin-link span {
  color: rgba(155, 95, 255, 0.85);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}

.ob-signin-link span:hover {
  color: rgba(155, 95, 255, 1);
}

/* ═══════════════════════════════
   SVG ELEMENT ANIMATIONS
═══════════════════════════════ */

/* --- Welcome slide --- */
.ob-ring {
  transform-origin: 100px 100px;
  animation: obRotate 14s linear infinite;
}
.ob-r2 {
  animation-direction: reverse;
  animation-duration: 20s;
}
.ob-spark-s {
  stroke-dasharray: 220;
  stroke-dashoffset: 220;
  animation: obDraw 1.5s cubic-bezier(0.4, 0, 0.2, 1) 0.3s forwards;
}
.ob-dot-top { animation: obPulse 2.4s ease-in-out infinite; }
.ob-dot-bot { animation: obPulse 2.4s ease-in-out 1.2s infinite; }
.ob-star    { animation: obSparkle 2.2s ease-in-out 0.0s infinite; }
.ob-star2   { animation: obSparkle 2.2s ease-in-out 0.6s infinite; }
.ob-star3   { animation: obSparkle 2.2s ease-in-out 1.2s infinite; }
.ob-star4   { animation: obSparkle 2.2s ease-in-out 1.8s infinite; }

/* --- Feed slide --- */
.ob-bar1 { --w: 54px; animation: obFill 1.3s ease-out 0.4s both; }
.ob-bar2 { --w: 42px; animation: obFill 1.3s ease-out 0.7s both; }
.ob-bar3 { --w: 32px; animation: obFill 1.3s ease-out 1.0s both; }

/* --- Invest slide --- */
.ob-coin        { animation: obPulse 2.2s ease-in-out infinite; transform-origin: 100px 58px; }
.ob-slider-knob { animation: obFloat 2.8s ease-in-out infinite; }

/* --- Post idea slide --- */
.ob-cursor { animation: obBlink 1s step-end infinite; }

/* --- Leaderboard slide --- */
.ob-pod1 { --h: 36px; animation: obGrowPod 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both; }
.ob-pod2 { --h: 24px; animation: obGrowPod 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) 0.6s both; }
.ob-pod3 { --h: 18px; animation: obGrowPod 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) 0.9s both; }

/* --- Observatory slide --- */
.ob-planet1  { transform-origin: 100px 90px; animation: obOrbit    7s linear infinite; }
.ob-planet1b { transform-origin: 100px 90px; animation: obOrbit    7s linear infinite reverse; }
.ob-planet2  { transform-origin: 100px 90px; animation: obOrbitOut 13s linear infinite; }
.ob-planet2b { transform-origin: 100px 90px; animation: obOrbitOut 13s linear infinite reverse; }

/* --- Chats slide --- */
.ob-msg1 { animation: obPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both; transform-origin: 82px 37px; }
.ob-msg2 { animation: obPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.7s both; transform-origin: 208px 73px; }
.ob-td1  { animation: obBounce 1.2s ease-in-out 0.0s infinite; }
.ob-td2  { animation: obBounce 1.2s ease-in-out 0.2s infinite; }
.ob-td3  { animation: obBounce 1.2s ease-in-out 0.4s infinite; }

/* --- Theme slide --- */
.ob-tc { animation: obPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* --- CTA slide --- */
.ob-cta-s  {
  stroke-dasharray: 260;
  stroke-dashoffset: 260;
  animation: obDraw 1.8s cubic-bezier(0.4, 0, 0.2, 1) 0.2s forwards;
}
.ob-cta-ring { transform-origin: 100px 100px; }
.ob-cr1 { animation: obRotate  14s linear infinite; }
.ob-cr2 { animation: obRotate  20s linear infinite reverse; }
.ob-cr3 { animation: obRotate  10s linear infinite; }
.ob-sp1 { animation: obSparkle 2.1s ease-in-out 0.0s infinite; }
.ob-sp2 { animation: obSparkle 2.1s ease-in-out 0.7s infinite; }
.ob-sp3 { animation: obSparkle 2.1s ease-in-out 1.4s infinite; }

/* ═══════════════════════════════
   KEYFRAMES
═══════════════════════════════ */

@keyframes obRotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes obPulse {
  0%, 100% { opacity: 0.7; transform: scale(1);    }
  50%       { opacity: 1;   transform: scale(1.08); }
}

@keyframes obFloat {
  0%, 100% { transform: translateY(0);   }
  50%       { transform: translateY(-5px); }
}

@keyframes obBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

@keyframes obFill {
  from { width: 0; }
  to   { width: var(--w, 40px); }
}

@keyframes obGrowPod {
  from { height: 0;        y: 175px; }
  to   { height: var(--h); y: calc(175px - var(--h, 20px)); }
}

@keyframes obDraw {
  from { stroke-dashoffset: var(--len, 260); }
  to   { stroke-dashoffset: 0; }
}

@keyframes obSparkle {
  0%, 100% { opacity: 0;   transform: scale(0.5); }
  50%       { opacity: 0.9; transform: scale(1);   }
}

@keyframes obPopIn {
  from { transform: scale(0); opacity: 0;    }
  to   { transform: scale(1); opacity: 0.85; }
}

@keyframes obBounce {
  0%, 100% { transform: translateY(0);   opacity: 0.65; }
  50%       { transform: translateY(-4px); opacity: 1;   }
}

@keyframes obOrbit {
  0%   { transform: rotate(0deg)   translateX(42px) rotate(0deg);    }
  100% { transform: rotate(360deg) translateX(42px) rotate(-360deg); }
}

@keyframes obOrbitOut {
  0%   { transform: rotate(0deg)    translateX(72px) rotate(0deg);    }
  100% { transform: rotate(-360deg) translateX(72px) rotate(360deg);  }
}

@keyframes obOrbFloat {
  0%, 100% { transform: translateY(0)    translateX(0);   }
  33%       { transform: translateY(-20px) translateX(10px); }
  66%       { transform: translateY(10px)  translateX(-15px); }
}

/* ── Achievements slide animations ── */
.ob-ach-c1 { animation: obAchSlideIn 0.5s cubic-bezier(0.34,1.56,0.64,1) 0.1s both; }
.ob-ach-c2 { animation: obAchSlideIn 0.5s cubic-bezier(0.34,1.56,0.64,1) 0.25s both; }
.ob-ach-c3 { animation: obAchSlideIn 0.5s cubic-bezier(0.34,1.56,0.64,1) 0.4s both; }
.ob-ach-total { animation: obAchSlideIn 0.5s cubic-bezier(0.34,1.56,0.64,1) 0.6s both; }
.ob-ach-check { animation: obAchCheck 0.45s cubic-bezier(0.34,1.56,0.64,1) 0.85s both; }
.ob-ach-prog  { animation: obAchProg 1.1s cubic-bezier(0.4,0,0.2,1) 0.55s both; }
.ob-ach-p1 { animation: obAchParticle 2s ease-in-out 0.9s infinite; }
.ob-ach-p2 { animation: obAchParticle 2s ease-in-out 1.3s infinite; }
.ob-ach-p3 { animation: obAchParticle 2s ease-in-out 1.7s infinite; }
.ob-ach-p4 { animation: obAchParticle 2s ease-in-out 2.1s infinite; }

@keyframes obAchSlideIn {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes obAchCheck {
  from { opacity: 0; transform: scale(0); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes obAchProg {
  from { width: 0; }
  to   { width: 60px; }
}
@keyframes obAchParticle {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50%       { opacity: 0.9; transform: scale(1.2); }
}

/* ═══════════════════════════════
   RESPONSIVE — MOBILE
═══════════════════════════════ */

@media (max-width: 520px) {

  .ob-overlay {
    align-items: flex-end;
  }

  .ob-card {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 88vh;
    /* Handle for drag feel */
    padding-top: 4px;
  }

  /* Handle bar */
  .ob-card::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.12);
    z-index: 5;
  }

  .ob-vis {
    width: 170px;
    height: 142px;
  }

  .ob-visual-wrap {
    padding: 8px 20px 0;
  }

  .ob-content {
    padding: 10px 20px 4px;
  }

  .ob-title {
    font-size: 1.36rem;
  }

  .ob-desc {
    font-size: 0.93rem;
    line-height: 1.55;
  }

  .ob-nav {
    padding: 12px 18px 28px; /* Extra bottom padding for home indicator */
  }

  .ob-cta-wrap {
    padding: 0 18px 24px;
  }

  .ob-btn-cta {
    padding: 13px 24px;
  }
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  .ob-overlay,
  .ob-slide,
  .ob-dot {
    transition: none;
  }

  .ob-ring,
  .ob-r2,
  .ob-spark-s,
  .ob-dot-top,
  .ob-dot-bot,
  .ob-star,
  .ob-star2,
  .ob-star3,
  .ob-star4,
  .ob-bar1,
  .ob-bar2,
  .ob-bar3,
  .ob-coin,
  .ob-slider-knob,
  .ob-cursor,
  .ob-pod1,
  .ob-pod2,
  .ob-pod3,
  .ob-planet1,
  .ob-planet1b,
  .ob-planet2,
  .ob-planet2b,
  .ob-msg1,
  .ob-msg2,
  .ob-td1,
  .ob-td2,
  .ob-td3,
  .ob-tc,
  .ob-cta-s,
  .ob-cr1,
  .ob-cr2,
  .ob-cr3,
  .ob-sp1,
  .ob-sp2,
  .ob-sp3,
  .ob-star-particle {
    animation: none;
  }

  .ob-bar1 { width: var(--w, 54px); }
  .ob-bar2 { width: var(--w, 42px); }
  .ob-bar3 { width: var(--w, 32px); }
  .ob-spark-s,
  .ob-cta-s { stroke-dashoffset: 0; }
  .ob-ach-card, .ob-ach-check, .ob-ach-total,
  .ob-ach-p1, .ob-ach-p2, .ob-ach-p3, .ob-ach-p4 { animation: none !important; opacity: 1; }
  .ob-ach-prog { width: 60px; }
}

/* ── Language switcher ── */
.ob-lang-switch {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 10;
}
.ob-lang-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.79rem;
  font-weight: 700;
  font-family: 'Syne', sans-serif;
  color: rgba(110,112,153,0.7);
  padding: 3px 5px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  letter-spacing: 0.05em;
}
.ob-lang-btn:hover { color: rgba(238,240,255,0.8); }
.ob-lang-btn.ob-lang-active {
  color: #E8C55A;
  background: rgba(232,197,90,0.1);
}
.ob-lang-sep {
  color: rgba(110,112,153,0.35);
  font-size: 0.71rem;
  user-select: none;
}
