/* Animated cyberpunk background */

.bg-anim {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-grid {
  position: absolute;
  inset: -100px;
  background-image:
    linear-gradient(rgba(167, 139, 250, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(167, 139, 250, 0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: gridPan 30s linear infinite;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

@keyframes gridPan {
  from { background-position: 0 0; }
  to { background-position: 60px 60px; }
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.32;
  will-change: transform;
}
.orb-1 {
  background: var(--amber);
  width: 720px; height: 720px;
  top: -15%; left: -10%;
  animation: orbFloat1 30s ease-in-out infinite;
}
.orb-2 {
  background: var(--violet);
  width: 600px; height: 600px;
  bottom: -20%; right: -10%;
  opacity: 0.28;
  animation: orbFloat2 36s ease-in-out infinite;
}
.orb-3 {
  background: var(--pink);
  width: 460px; height: 460px;
  top: 35%; left: 55%;
  opacity: 0.18;
  animation: orbFloat3 40s ease-in-out infinite;
}
.orb-4 {
  background: var(--amber-deep);
  width: 400px; height: 400px;
  top: 50%; left: 8%;
  opacity: 0.22;
  animation: orbFloat4 28s ease-in-out infinite;
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(80px, 60px) scale(1.05); }
  66% { transform: translate(-40px, 100px) scale(0.95); }
}
@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-100px, -80px) scale(1.1); }
}
@keyframes orbFloat3 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-60px, -50px); }
}
@keyframes orbFloat4 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(60px, -80px); }
}

.bg-scan {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    180deg,
    transparent 0,
    transparent 2px,
    rgba(167, 139, 250, 0.015) 2px,
    rgba(167, 139, 250, 0.015) 3px
  );
  pointer-events: none;
}

.bg-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(6, 5, 13, 0.6) 100%);
  pointer-events: none;
}

/* ============================================
   PREMIUM EFFECTS — confetti, coin, ripple, press
   ============================================ */

/* Coin shower particle */
.fx-coin {
  position: fixed;
  z-index: 9998;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fde68a, #fbbf24 60%, #b45309);
  border: 1px solid #fcd34d;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Instrument Serif', serif;
  font-weight: 700;
  font-size: 13px;
  color: #78350f;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: coinFly var(--dur, 1000ms) cubic-bezier(0.22, 0.6, 0.4, 1) forwards;
  will-change: transform, opacity;
}
@keyframes coinFly {
  0%   { transform: translate(-50%, -50%) scale(0.4) rotate(0); opacity: 0; }
  15%  { transform: translate(-50%, -50%) scale(1)   rotate(0); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0.6) rotate(var(--rot)); opacity: 0; }
}

/* Ripple click feedback */
.has-ripple {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.fx-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0);
  animation: rippleAnim 0.6s cubic-bezier(0.22, 0.85, 0.3, 1) forwards;
  pointer-events: none;
  z-index: 0;
}
@keyframes rippleAnim {
  to {
    transform: scale(2.6);
    opacity: 0;
  }
}

/* Subtle press scale on active buttons */
.is-pressing {
  transform: scale(0.96) !important;
  transition: transform 0.08s ease-out !important;
}
.is-pressing.btn-primary,
.is-pressing.btn-violet,
.is-pressing.claim-btn,
.is-pressing.game-btn {
  filter: brightness(1.1);
}
.btn, .claim-btn, .game-btn, .nav-item, .cas-tab, .action-tile, .land-cta-primary {
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.15s ease,
              box-shadow 0.2s ease,
              filter 0.15s ease,
              border-color 0.15s ease;
}

/* Screen transition — fade + slight lift */
.screen.fx-enter {
  animation: screenEnter 0.5s cubic-bezier(0.22, 0.85, 0.3, 1);
}
@keyframes screenEnter {
  from { opacity: 0; transform: translateY(8px); filter: blur(2px); }
  to   { opacity: 1; transform: translateY(0);   filter: blur(0); }
}

/* Card hover lift — applies to all cards in the game */
.card,
.kpi,
.bank-card,
.cc-card,
.prop-card,
.gear-card,
.fish-card,
.tier-card,
.store-card,
.stock-card,
.ach,
.profile-money-tile,
.land-feat,
.land-step,
.land-tier,
.preview-row {
  transition:
    transform 0.25s cubic-bezier(0.22, 0.85, 0.3, 1),
    box-shadow 0.25s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

/* Topbar buttons — lift on hover */
.discord-btn:hover,
.sfx-toggle:hover {
  transform: translateY(-1px);
}

/* Pill / nav-badge bounce on update */
@keyframes badgePop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.pill.fx-pop { animation: badgePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* Inputs — subtle focus glow */
.auth-input,
.bet-input input,
.bank-select,
.stock-qty,
input[type="text"],
input[type="number"],
input[type="password"],
select {
  transition: border-color 0.15s ease, box-shadow 0.18s ease, background 0.15s ease;
}
.auth-input:focus,
.bet-input input:focus,
.bank-select:focus,
.stock-qty:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
select:focus {
  border-color: var(--amber-soft) !important;
  box-shadow: 0 0 0 3px var(--amber-glow), 0 0 20px var(--amber-glow);
  outline: none;
}

/* Toast — slightly springier entrance */
.toast {
  animation: toastIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes toastIn {
  from { transform: translateX(40px) scale(0.85); opacity: 0; }
  to   { transform: translateX(0)   scale(1);    opacity: 1; }
}

/* Number flash — extend existing flash with subtle scale */
.flash-up { animation: flashUpPremium 0.7s ease; }
.flash-down { animation: flashDownPremium 0.7s ease; }
@keyframes flashUpPremium {
  0%   { color: var(--text-0); transform: scale(1); }
  20%  { color: var(--success); transform: scale(1.06); }
  60%  { color: var(--success); transform: scale(1); }
  100% { color: var(--text-0); transform: scale(1); }
}
@keyframes flashDownPremium {
  0%   { color: var(--text-0); transform: scale(1); }
  30%  { color: var(--danger); transform: scale(0.96); }
  100% { color: var(--text-0); transform: scale(1); }
}

/* Cooldown buttons — soft pulsing border */
.btn-cooldown {
  position: relative;
}
.btn-cooldown::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid var(--border-mid);
  animation: cdPulse 1.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes cdPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.02); }
}

/* Reduced motion — honour the OS setting fully. Besides the one-shot effects,
   also stop the perpetual ambient loops (background orbs, grid pan, shimmers,
   pulses) that would otherwise keep moving for motion-sensitive users. */
@media (prefers-reduced-motion: reduce) {
  .fx-coin, .fx-ripple,
  .screen.fx-enter,
  .toast,
  .flash-up, .flash-down,
  .btn-cooldown::before {
    animation: none !important;
  }
  .is-pressing { transform: none !important; }

  /* Blanket clamp: collapse every animation/transition to a single instant
     frame so nothing loops, while one-shot transitions still "complete". */
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
