/* ═══════════════════════════════════════════════════════════
   FX LAYER — sits above everything, pointer-events pass through
   ═══════════════════════════════════════════════════════════ */

.fx-layer {
  position: fixed;
  inset: 0;
  z-index: 450;   /* above scroller (380) + nav (400), below modal (500) */
  pointer-events: none;
  overflow: hidden;
}

/* ── Coin burst ──────────────────────────────────────────── */
.fx-coin {
  position: fixed;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff4b0 0%, #ffd700 45%, #b8860b 100%);
  box-shadow:
    0 0 6px rgba(255, 215, 0, 0.9),
    inset -1px -2px 2px rgba(0, 0, 0, 0.3),
    inset 1px 1px 2px rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  animation: fx-coin-arc 550ms cubic-bezier(0.4, 0.05, 0.6, 0.95) forwards;
  will-change: transform, opacity;
}
.fx-coin.is-boss {
  width: 16px; height: 16px;
  box-shadow:
    0 0 10px rgba(255, 215, 0, 1),
    inset -1px -2px 2px rgba(0, 0, 0, 0.3),
    inset 1px 1px 2px rgba(255, 255, 255, 0.6);
}
@keyframes fx-coin-arc {
  0% {
    transform: translate(-50%, -50%) scale(0.5) rotate(0deg);
    opacity: 0;
  }
  20% {
    transform: translate(-50%, -50%) scale(1.1) rotate(180deg);
    opacity: 1;
  }
  85% {
    opacity: 1;
    transform: translate(calc(-50% + var(--fx-tx) * 0.95), calc(-50% + var(--fx-ty) * 0.95)) scale(0.9) rotate(720deg);
  }
  100% {
    transform: translate(calc(-50% + var(--fx-tx)), calc(-50% + var(--fx-ty))) scale(0.3) rotate(900deg);
    opacity: 0;
  }
}

/* ── XP orb ──────────────────────────────────────────────── */
.fx-xp-orb {
  position: fixed;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #d0e0ff 0%, #7b9cff 60%, #3d5aa8 100%);
  box-shadow: 0 0 8px rgba(123, 156, 255, 0.9);
  transform: translate(-50%, -50%);
  animation: fx-xp-arc 600ms cubic-bezier(0.4, 0.05, 0.6, 0.95) forwards;
  will-change: transform, opacity;
}
@keyframes fx-xp-arc {
  0%   { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
  20%  { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
  100% {
    transform: translate(calc(-50% + var(--fx-tx)), calc(-50% + var(--fx-ty))) scale(0.4);
    opacity: 0;
  }
}

/* ── Header stat pulse ───────────────────────────────────── */
@keyframes fx-stat-pop {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.1); }
}
.fx-stat-pulse {
  animation: fx-stat-pop 300ms cubic-bezier(0.3, 1.5, 0.7, 1);
}

/* ── Boss kill: flash + shards + ribbon + shake ─────────── */
.fx-boss-flash {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
  animation: fx-boss-flash-anim 400ms ease-out forwards;
}
@keyframes fx-boss-flash-anim {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  100% { opacity: 0; }
}

.fx-shard {
  position: fixed;
  width: 8px; height: 20px;
  background: linear-gradient(180deg, #ff6b6b 0%, #b91d1d 100%);
  transform: translate(-50%, -50%);
  animation: fx-shard-fly 700ms cubic-bezier(0.2, 0.6, 0.6, 1) forwards;
  will-change: transform, opacity;
  box-shadow: 0 0 4px rgba(255, 100, 100, 0.6);
}
@keyframes fx-shard-fly {
  0% {
    transform: translate(-50%, -50%) scale(0.4) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--fx-tx)), calc(-50% + var(--fx-ty))) scale(1) rotate(var(--fx-rot));
    opacity: 0;
  }
}

.fx-boss-ribbon {
  position: fixed;
  left: 0; right: 0;
  top: 40%;
  padding: var(--sp-4);
  text-align: center;
  font-family: 'Trajan Pro', 'Cinzel', Georgia, serif;
  font-size: clamp(28px, 5vw, 56px);
  font-weight: 900;
  color: #ffd700;
  letter-spacing: 4px;
  text-shadow:
    0 0 20px rgba(255, 215, 0, 0.9),
    0 0 40px rgba(255, 100, 0, 0.6),
    0 2px 4px rgba(0, 0, 0, 0.8);
  background: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.6) 20%, rgba(20, 0, 0, 0.7) 50%, rgba(0, 0, 0, 0.6) 80%, transparent 100%);
  border-top:    1px solid rgba(255, 215, 0, 0.5);
  border-bottom: 1px solid rgba(255, 215, 0, 0.5);
  animation: fx-ribbon-slide 1.4s cubic-bezier(0.3, 1, 0.7, 1) forwards;
  will-change: transform, opacity;
}
@keyframes fx-ribbon-slide {
  0%   { transform: translateX(-100vw) skewX(-10deg); opacity: 0; }
  15%  { transform: translateX(0) skewX(-10deg);      opacity: 1; }
  70%  { transform: translateX(0) skewX(-10deg);      opacity: 1; }
  100% { transform: translateX(100vw) skewX(-10deg);  opacity: 0; }
}

@keyframes fx-shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-4px, 2px); }
  20% { transform: translate(4px, -2px); }
  30% { transform: translate(-3px, -3px); }
  40% { transform: translate(3px, 3px); }
  50% { transform: translate(-2px, 2px); }
  60% { transform: translate(2px, -1px); }
  70% { transform: translate(-1px, 1px); }
  80% { transform: translate(1px, 0); }
  90% { transform: translate(0, 1px); }
}
body.fx-screen-shake {
  animation: fx-shake 300ms cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

/* ── Level up shimmer + "+1" ─────────────────────────────── */
.fx-shimmer {
  position: fixed;
  border-radius: 50%;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(
    110deg,
    transparent 30%,
    rgba(255, 215, 0, 0.9) 50%,
    transparent 70%
  );
  background-size: 200% 100%;
  background-position: -100% 0;
  animation: fx-shimmer-sweep 700ms ease-out forwards;
  mix-blend-mode: screen;
}
@keyframes fx-shimmer-sweep {
  0%   { background-position: -100% 0; opacity: 0; }
  20%  { opacity: 1; }
  100% { background-position: 200% 0;  opacity: 0; }
}
.fx-levelup-num {
  position: fixed;
  font-family: inherit;
  font-size: 22px;
  font-weight: 900;
  color: #ffd700;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.9), 0 2px 3px #000;
  transform: translate(-50%, 0);
  animation: fx-levelup-float 1000ms cubic-bezier(0.2, 0.6, 0.4, 1) forwards;
  pointer-events: none;
}
@keyframes fx-levelup-float {
  0%   { opacity: 0; transform: translate(-50%, 0)     scale(0.6); }
  20%  { opacity: 1; transform: translate(-50%, -6px)  scale(1.15); }
  70%  { opacity: 1; transform: translate(-50%, -32px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50px) scale(0.9); }
}

/* ═══════════════════════════════════════════════════════════
   AWAKENING REVEAL — full-screen ~2s cinematic
   ═══════════════════════════════════════════════════════════ */
.fx-awaken-overlay {
  position: fixed;
  inset: 0;
  z-index: 480;
  background: radial-gradient(ellipse at center, rgba(20, 15, 5, 0.85) 0%, rgba(0, 0, 0, 0.95) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 350ms ease-out;
}
.fx-awaken-overlay.is-active { opacity: 1; }
.fx-awaken-overlay.is-fading  { opacity: 0; }

.fx-awaken-beam {
  position: absolute;
  left: 50%;
  top: -10%;
  bottom: -10%;
  width: 300px;
  transform: translateX(-50%);
  background: linear-gradient(
    180deg,
    transparent 0%,
    var(--fx-class-color, #ffd700) 50%,
    transparent 100%
  );
  opacity: 0;
  filter: blur(40px);
  animation: fx-awaken-beam-anim 2s ease-in-out;
}
@keyframes fx-awaken-beam-anim {
  0%   { opacity: 0; transform: translateX(-50%) scaleY(0.4); }
  20%  { opacity: 0.6; }
  50%  { opacity: 0.9; transform: translateX(-50%) scaleY(1.2); }
  85%  { opacity: 0.6; }
  100% { opacity: 0; transform: translateX(-50%) scaleY(1); }
}

.fx-awaken-content {
  position: relative;
  z-index: 1;
  text-align: center;
  animation: fx-awaken-content-rise 1.4s cubic-bezier(0.2, 0.6, 0.4, 1);
}
@keyframes fx-awaken-content-rise {
  0%   { opacity: 0; transform: translateY(40px) scale(0.85); }
  30%  { opacity: 1; }
  70%  { opacity: 1; transform: translateY(-4px) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.fx-awaken-eyebrow {
  font-family: 'Trajan Pro', 'Cinzel', Georgia, serif;
  font-size: 14px;
  letter-spacing: 6px;
  color: #cccccc;
  text-transform: uppercase;
  margin-bottom: 20px;
  opacity: 0.85;
}
.fx-awaken-title {
  font-family: 'Trajan Pro', 'Cinzel', Georgia, serif;
  font-size: clamp(40px, 8vw, 84px);
  font-weight: 900;
  letter-spacing: 6px;
  text-transform: uppercase;
  text-shadow:
    0 0 30px currentColor,
    0 0 60px currentColor,
    0 2px 4px #000;
}
.fx-awaken-skip {
  position: absolute;
  bottom: 40px;
  left: 0; right: 0;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 2px;
  text-transform: uppercase;
  animation: fx-awaken-skip-fade 2s ease-in;
}
@keyframes fx-awaken-skip-fade {
  0%, 30% { opacity: 0; }
  100%    { opacity: 1; }
}
